我知道这个问题已经被问到,但我不知道如何得到它的工作。 我想改变我的标题栏的背景。
我不想改变任何关于我的应用程序或我的背景的风格。
我在这个网站上跟着各种post,但是他们都没有给出令人满意的结果。
我会认为这会像设定一样简单
<style name="AppTheme" parent="AppBaseTheme"> <item name="android:windowTitleBackgroundStyle">@drawable/backrepeat</item> </style>
在styles.xml中
但是这不会改变。
以下的完整性是我的回复文件
<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" >
您可以在创build活动时使用它。 (的onCreate)
ActionBar bar = getActionBar(); //for color bar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#00C4CD"))); //for image bar.setBackgroundDrawable(getResources().getDrawable(R.drawable.settings_icon));
你可以改变你的标题颜色使用这个代码在oncreate()中添加这些行:
ColorDrawable colorDrawable = new ColorDrawable(Color.parseColor("#20a780")); getSupportActionBar().setBackgroundDrawable(colorDrawable);