当前位置: 代码迷 >> 综合 >> 改变actionbar的样式
  详细解决方案

改变actionbar的样式

热度:29   发布时间:2024-01-17 11:40:18.0

在使用actionbar的时候,有些时候item的字体太少或者想要自定义颜色,可以使用如下的方法,先在AndroidManifest.xml找到android:theme="@style/AppTheme"语句,根据android:theme设置的值在res/values/styles.xml找到它的定义,类似下面这一种

<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme"><!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
然后添加方法如下:

<resoruces><!-- Application theme. --><style name="AppTheme" parent="AppBaseTheme"><item name="android:actionMenuTextAppearance">@style/MenuTextStyle</item></style><style name="MenuTextStyle"><item name="android:textColor">@color/black</item>    <!-- 自定义字体颜色 --><item name="android:textSize">18sp</item>    <!-- 自定义字体大小 --></style>
</resoruces>

成功的改变了actionbar上的样式。