
我一直在尝试为我的工具栏添加自定义样式,但任何结果……
清单
<application androID:allowBackup="true" androID:icon="@mipmap/ic_launcher" androID:label="@string/app_name" androID:theme="@style/theme.Design">
style.xml文件
<resources> <style name="theme.Design" parent="Base.theme.Design"> </style> <style name="Base.theme.Design" parent="theme.AppCompat.light.NoActionbar"> <item name="colorPrimary">@color/red</item> <item name="colorPrimaryDark">@color/red</item> <item name="colorAccent">@color/red</item> <item name="androID:textcolorPrimary">@color/white</item> <item name="androID:windowActionbarOverlay">true</item> <item name="windowActionbarOverlay">true</item> </style> ...
和布局中的工具栏
<androID.support.v7.Widget.Toolbar androID:ID="@+ID/home_toolbar" androID:layout_wIDth="match_parent" androID:layout_height="?attr/actionbarSize"/>解决方法 谢谢,但任何解决方案都有效.
<androID.support.v7.Widget.Toolbar androID:ID="@+ID/home_toolbar" androID:layout_wIDth="match_parent" androID:layout_height="?attr/actionbarSize" androID:background="?attr/colorPrimary"/>
要么
toolbar.setBackgroundcolor(color.parsecolor("#80000000")); 可能是因为我的工具栏在androID.support.design.Widget.CoordinatorLayout(放一个androID.support.design.Widget.floatingActionbutton)?
总结以上是内存溢出为你收集整理的android – 如何更改工具栏颜色全部内容,希望文章能够帮你解决android – 如何更改工具栏颜色所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)