自定义标题栏透明并且不影响界面展示,不占空间
来源:互联网 发布:xampp mac 安装教程 编辑:程序博客网 时间:2024/05/18 03:53
一直觉得这种标题栏很神奇
还有就是那种,滑动的时候标题栏的颜色也跟着变化,有机会一定试试,然后补上。
哎……,我人生中的第一份工作,还没做一个月就结束啦!老板嫌弃android和iOS开发慢,喜欢上H5了,寒心呀……,满怀着的激情就这样夭折了。
还是那句话:日出东海落西山,愁也一天,喜也一天。
老规矩,上效果图
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.zhuowang.wangzhe.myapplication2.fragment.ShouYeFragment"> <!-- TODO: Update blank fragment layout --> <android.support.v7.widget.RecyclerView android:id="@+id/shouye_recyclerview" android:layout_width="match_parent" android:layout_height="match_parent"> </android.support.v7.widget.RecyclerView> <include layout="@layout/custom_toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" /></FrameLayout>//这里我们要注意,总布局要是FrameLayout帧布局,标题栏要在最下面,这样,标题栏才会出现在主体的上方,否则会被遮盖
再补充一下标题栏的布局custom_toolbar.xml,及要点
<?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="?actionBarSize" android:background="#00000000" --》背景全透明 android:orientation="horizontal"> <LinearLayout android:padding="6dp" android:layout_marginLeft="40dp" android:layout_marginRight="40dp" android:background="@drawable/custom_toolbar_shape" --》创建shape,设置四边的弧度 android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:orientation="horizontal"> <ImageView android:src="@drawable/ic_search_white_18dp" android:layout_width="0dp" android:layout_weight="2" android:gravity="center" android:layout_height="match_parent" /> <TextView android:background="@color/white" android:layout_width="1dp" android:layout_height="match_parent" /> <TextView android:text="商品搜索" android:textSize="@dimen/toolbar_textsize" android:textColor="@color/white" android:layout_width="0dp" android:paddingLeft="5dp" android:gravity="center_vertical" android:layout_weight="8" android:layout_height="match_parent" /> </LinearLayout></LinearLayout><-- 透明度:ff0000不透明 > e00000半透明 > 000000全透明 -->
创建Shape custom_toolbar_shape.xml
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android"> <corners android:radius="6dp" /> --弧度 <stroke android:width="1dp" android:color="@color/white" /> --边框 <solid android:color="#7faaaaaa"/> --内部填充色</shape>
0 0
- 自定义标题栏透明并且不影响界面展示,不占空间
- 使QScrollArea的背景透明,并且不影响子控件
- 不同类占空间大小
- android界面不显示标题栏
- Html隐藏占空间与隐藏不占空间
- input背景透明并且不穿透
- iOS navigationBar透明效果,不影响barButtonItem
- .父元素透明不影响子元素
- 不占物理空间的div
- Andriod 设置输入法不影响界面
- androidStudio去掉标题栏,状态栏透明,状态栏不遮挡页面。
- 结束push_back的输入并且不影响下一次输入
- Oracle之如何在线创建索引,并且不影响update
- u盘文件不显示却占空间
- Jquery之不占空间的张一山图片显示
- Android中弹出输入法界面不影响app界面布局
- 让弹出输入法界面不影响界面布局
- 可滑动可点击,不占全屏的自定义控件
- 暑假训练第一期---思维题1
- 旋转矩阵 北航2008
- android第一行代码笔记
- nginx 简单配置
- em, rem
- 自定义标题栏透明并且不影响界面展示,不占空间
- 粗识静态链表
- getContext,this,getApplicationContext区别
- 微软人工智能平台开源:利用《我的世界》测试AI软件
- One Edit Distance
- js中值引用和地址引用
- 解决安装mysql的”A Windows service with the name MySQL already exists.“问题
- 面向接口编程的小例子
- java实现qq邮箱每天定时发送邮件