Android 标题栏沉浸式的实现
来源:互联网 发布:手机版ps软件 编辑:程序博客网 时间:2024/06/05 21:11
网上是有好多的实现方式,也有具体的代码,每个人总能找到适合自己的,感觉自己能用的方式来实现这些功能
先看效果,
步骤1,设置Application的theme 这个theme会使你NoTitlebar 也没有状态栏 全部都是你的布局 从头到尾 我比较喜欢这种方式
android:theme="@style/AppTheme"
<?xml version="1.0" encoding="UTF-8" ?><resources> <!-- Application theme. --> <style name="AppTheme" parent="android:Theme.Holo.Light.NoActionBar.TranslucentDecor" type="text/css"> <!-- All customizations that are NOT specific to a particular API-level can go here. --></style> </resources>
步骤二,
在你要沉浸的布局中加
android:clipToPadding="true"android:fitsSystemWindows="true"这两句话 这其中 是有一个问题的 因为你加了这两句话之后 你的那个布局成了 从一开始最上面到最下面 也就是 你布局整体向上提了标题栏的高度
这个问题怎么解决 直接用paddingtop="25dp" 我们美工说的标题栏的高度一般都是50px 所以适配就是25dp 同时 你把的最上面的布局扩大25dp 具体实现 看下面的代码
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="95dp" android:clipToPadding="true" android:fitsSystemWindows="true" android:paddingTop="25dp" android:background="#af4752" ><TextView android:layout_width="match_parent" android:layout_height="match_parent" android:text="你问我爱你有多深!" android:textSize="40dp" android:gravity="center" /></LinearLayout>
如此 我自己认为可以的沉浸式的标题栏完成,这种实现方式灵活多变,自定义的成分比较高,比较推荐....额,虽然我只是知道这一种
0 0
- Android 标题栏沉浸式的实现
- Android 沉浸式标题栏的快速实现方式
- android沉浸式标题栏
- Android 沉浸式标题栏
- 关于沉浸式标题栏的实现
- android状态栏标题栏的沉浸式模式
- Android沉浸式标题栏迄今为止最完美的解决方案
- android 沉浸式的实现
- 实现android4.4沉浸式标题栏
- 借助SystemBarTint实现透明标题栏(沉浸式)
- android沉浸式状态栏、fitsSystemWindows、标题栏折叠
- Android标题栏沉浸效果
- 实现android的通知栏的背景和标题栏同步(沉浸状态)
- 沉浸式标题栏样式
- 沉浸式标题栏
- android沉浸式状态栏的实现
- Android 沉浸式全屏的实现方法
- Android 沉浸式全屏的实现方法
- 【Java多线程与并发库】2.传统定时器技术回顾
- Flex 布局中,让元素横向排开后,让最后一个元素靠右边
- 合伙协议
- iOS开发masonry动态布局cell高度
- CURL常用命令
- Android 标题栏沉浸式的实现
- MapReduce:详解Shuffle过程
- IPHONE,zlib库编译iphone版本
- 关于如何连接阿里云服务器上的MySQL数据库的解答
- puppet的第一个自己写的模块
- 安卓webView加载HTML数据
- pl/sql 过程 函数
- 0/1背包问题
- IE(IE6/IE7/IE8)支持HTML5标签