Android自定义标题栏
来源:互联网 发布:酷家乐软件使用方法 编辑:程序博客网 时间:2024/06/14 07:21
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);//必须设置在setContentView之前。 setContentView(R.layout.activity_main);getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title);//custom_title为自定义标题栏布局
}
修改AndroidManifest.xml中该Activity的theme为以下:
其中parent要设为android:Theme或android:Theme.Light,不能设为android:Theme.Holo.Light,否则会报You cannot combine custom titles with other title features错误,可能是因为android:Theme.Holo.Light是用于ActionBar的,跟自定义标题栏有冲突。
<style name="mystyle" parent="android:Theme"><item name="android:windowTitleSize">50dp</item>//改为跟自定义标题栏的高度一样<item name="android:windowTitleBackgroundStyle">@color/title_bg</item>//改为跟自定义标题栏的背景一样</style>
0 0
- android自定义标题栏progressBar
- Android自定义标题栏
- 自定义android标题栏
- android实现自定义标题栏
- Android自定义标题栏
- Android 自定义标题栏
- Android 自定义标题栏
- Android自定义标题栏
- Android自定义标题栏
- android之自定义标题栏
- Android自定义标题栏
- Android 自定义标题栏运用
- Android 自定义标题栏
- android ListView+自定义标题栏
- Android 自定义标题栏
- Android:自定义标题栏
- Android Actionbar自定义标题栏
- 自定义Android标题栏TitleBar
- 从头认识java-1.8 创建和操纵对象(1)
- API Guides > Contacts Provider
- iOS:KVO的概述与使用
- Linux远程管理器xshell和xftp使用教程
- 六款优秀的 Linux 基准测试工具
- Android自定义标题栏
- 达人眼中的WINCE网络驱动
- Spinner 相关
- 左值与右值
- RequireJS入门(一)
- Sort
- Svn 利用 乌龟解锁
- NEXUS启动失败
- swift 初级 C语言和swift中 switch用法区别