Android -- 自定义标题栏,背景颜色填充满
- 设置标题栏背景
1> 准备背景图片: background_pix.png

注:用背景图片比用颜色好处,可以让背景看起来有凹凸感.
2> drawable文件夹下放xml文件
bitmap_repeat.xml
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/title_pic"
android:tileMode="repeat">
</bitmap>
3> 定义样式文件style.xml
<?xml version="1.0" encoding="utf-8"?> <resources> <!-- 自定义标题样式 --> <style name="StatusBarBackground"> <item name="android:background">@drawable/bitmap_repeat </item> </style> <style name="XTheme" parent="android:Theme"> <!-- Window attributes --> <item name="android:windowTitleBackgroundStyle">@style/StatusBarBackground </item> </style> <!-- 自定义标题样式 --> </resources>
4> 在manifest.xml中引用主题android:theme="@style/XTheme"
<activity android:name=".activity.MainActivty" android:screenOrientation="portrait" android:configChanges="keyboardHidden|orientation" android:theme="@style/XTheme"> </activity>
- 自定义标题栏layout文件ct_title.xml
注: ct_title.xml文件中用如下方式设置标题栏背景会出下填充不满效果
android:background="@drawable/bitmap_repeat "
- 在activity中引用
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.main);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,R.layout.ct_title);
}

转载请注明出处:http://www.cnblogs.com/yydcdut/p/3694597.html
详细请见:http://www.iteye.com/topic/760314
代码:http://pan.baidu.com/s/1dD1Qx01
Second.zip
Android -- 自定义标题栏,背景颜色填充满的更多相关文章
- (转)Android 自定义 spinner (背景、字体颜色)
Android 自定义 spinner (背景.字体颜色) (2012-07-04 17:04:44) 1.准备两张图片,并做好9.png 2.在drawable中定义spinner_sele ...
- [置顶]
xamarin android自定义标题栏(自定义属性、回调事件)
自定义控件的基本要求 这篇文章就当是自定义控件入门,看了几篇android关于自定义控件的文章,了解了一下,android自定义控件主要有3种方式: 自绘控件:继承View类,所展示的内容在OnDra ...
- android 自定义进度条颜色
android 自定义进度条颜色 先看图 基于产品经理各种自定义需求,经过查阅了解,下面是自己对Android自定义进度条的学习过程! 这个没法了只能看源码了,还好下载了源码, sources\b ...
- setFeatureInt、android 自定义标题栏
Android 自带的toolbar 往往不能很好的的满足我们的个性化要求.因此我们经常使用自定的的标题栏.而Android系统本身也允许我们自定以标题栏. 记录一下,自定义标题栏常遇到的问题.先上效 ...
- android:更改PagerTabStrip背景颜色,标题字体样式、颜色和图标,以及指示条的颜色
1.更改PagerTabStrip背景颜色 我们直接在布局中设置background属性可以: <android.support.v4.view.ViewPager android:id=&qu ...
- Android 自定义标题栏
开发 Android APP 经常会用到自定义标题栏,而有多级页面的情况下还需要给自定义标题栏传递数据. 本文要点: 自定义标题填充不完整 自定义标题栏返回按钮的点击事件 一.代码 这里先介绍一下流程 ...
- (转)Android 自定义标题栏(title栏)
转:http://blog.csdn.net/jamin0107/article/details/6715678 第一步,向实现自定义标题栏,需要在onCreate方法里这样写 requestWind ...
- Android 自定义 spinner (背景、字体颜色)
转自:http://blog.sina.com.cn/s/blog_3e333c4a010151cj.html 1.准备两张图片,并做好9.png 2.在drawable中定义spinner_se ...
- Android自定义Button字体颜色和背景颜色
http://blog.csdn.net/breeze666/article/details/7747649
随机推荐
- 【Performance】chrome调试面板
本篇文章以chrome版本67.0.3396.99为例,说明性能方面的调试.
- 1035 Password (20)(20 point(s))
problem To prepare for PAT, the judge sometimes has to generate random passwords for the users. The ...
- 1010 Radix (25)(25 point(s))
problem Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true ...
- Centos7 如何减少/home分区,扩大/root分区
把/home内容备份,然后将/home文件系统所在的逻辑卷删除,扩大/root文件系统,新建/home:tar cvf /tmp/home.tar /home #备份/home umount /hom ...
- 某gov的逻辑漏洞
首先找一个号 在企业信息里面查看到大量的企业名称和组织机构代码 随后去找回密码那 可以看到是直接显示了用户名和密码 随后去登录 可以看到大量的工程信息个企业注册信息
- Alpha 冲刺报告5
组长:吴晓晖 今天完成了哪些任务: 将服务端程序基本部署在阿里云上,还未进行测试 完成了手写记录的代码实现 处理团队问题 为明天的编程任务做准备 展示GitHub当日代码/文档签入记录: 明日计划: ...
- vijos p1768 数学
链接:点我 预处理:b[i][j]表示a[1] ... a[j]中比a[i]小的数的数量. 设 int get_lower_count(int b[], int l, int r) { return ...
- Codeforces Round #297 (Div. 2)A. Vitaliy and Pie 水题
Codeforces Round #297 (Div. 2)A. Vitaliy and Pie Time Limit: 2 Sec Memory Limit: 256 MBSubmit: xxx ...
- codevs 1204 寻找子串位置 KMP
1204:寻找子串位置 Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 18K Solved: 8K Description 给出字符串a和字符串b,保 ...
- poj 1062 昂贵的聘礼 最短路 dijkstra
#include <cstdio> #include <cmath> #include <cstring> #include <ctime> #incl ...