android - 更改背景android标题栏

标签 android titlebar custom-titlebar

我知道有人问过这个问题,但我不知道如何让它发挥作用。我想更改标题栏的背景。

我不想更改有关我的申请风格或背景的任何其他内容。

我关注了这个网站上的各种帖子,但似乎没有一个能给出令人满意的结果。

我认为它会像设置一样简单

<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/

相关文章:

java - 获取项目在 ListView 中的位置?

ios - 如何为多标签 View 设置标题栏?

python tkinter 恢复没有标题栏的窗口

android - AlertDialog setCustomTitle 样式以匹配标准 AlertDialog 标题

android - 我的带有 ListView 的自定义标题未显示正确的高度和格式

android - 使用 Samba/JCIFS 问题写入/上传文件 (SmbAuthException : Access is denied)

java - 适配器中的ArrayList?

android - 如何在 Android 中更改自定义对话框标题栏的高度

android - 使用 ActionBar 添加自定义标题栏

android - 在FrameLayout中动态添加多个 fragment