我知道有人问过这个问题,但我不知道如何让它发挥作用。我想更改标题栏的背景。
我不想更改有关我的申请风格或背景的任何其他内容。
我关注了这个网站上的各种帖子,但似乎没有一个能给出令人满意的结果。
我认为它会像设置一样简单
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:windowTitleBackgroundStyle">@drawable/backrepeat</item>
</style>
在 styles.xml 中
然而,这并没有带来任何改变。
为了完整起见,下面是我的 backrepeat 文件
<bitmap
xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/bg_diamonds"
android:tileMode="repeat"
android:dither="true"
/>
以及manifest.xml中的代码
<application
android:allowBackup="true"
android:icon="@drawable/maxmm_start_icon"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
最佳答案
您可以在 Activity 创建时使用它。 (创建时)
ActionBar bar = getActionBar();
//for color
bar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#00C4CD")));
//for image
bar.setBackgroundDrawable(getResources().getDrawable(R.drawable.settings_icon));
关于android - 更改背景android标题栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19112099/