MainActivity.class:
ActionBar actionBar = this.getActionBar();
actionBar.setDisplayOptions(ActionBar.DISPLAY_HOME_AS_UP, ActionBar.DISPLAY_HOME_AS_UP);
actionBar.setDisplayHomeAsUpEnabled(false);// 隐藏返回上级的箭头
actionBar.setHomeButtonEnabled(false);//没有点击效果
actionBar.setBackgroundDrawable(this.getResources().getDrawable(R.drawable.drawable_white));//设置背景
AndroidManifest.xml
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
color.xml:
<resources>
<color name="register_2_verify_error_color">#ffff0000</color>
<drawable name="drawable_white">#FFFFFFFF</drawable>
</resources>
style.xml:
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:actionBarStyle">@style/MyActionBar</item>
</style>
<style name="MyActionBar" parent="@android:style/Widget.Holo.ActionBar">
<item name="android:titleTextStyle">@style/TextAppearance.Holo.Widget.ActionBar.Title.Own</item>
</style>
<style name="TextAppearance.Holo.Widget.ActionBar.Title.Own" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textColor">#000000</item><!--字体颜色-->
<item name="android:textStyle">bold</item><!--字体加粗-->
</style>
android ActionBar的使用
最新推荐文章于 2020-03-08 17:13:56 发布