Android 底部导航栏按钮突出
2016-12-27 11:51
218 查看
小知识:
Freeline( Android平台上的秒级编译方案) 阿里巴巴出品,类似Instant Run功能;用了下确实比较爽而且免费推荐大家使用,以下为官方详细介绍
使用文档:https://www.freelinebuild.com/docs/
原理说明:https://yq.aliyun.com/articles/59122?spm=5176.100240.searchblog.56.Sqd0hT
底部导航栏按钮突出,先上效果图
之前项目做法:RelativeLayout+RadioGroup+ImageView/TextView
现在做法:
主要是使用了clipChildren属性,设置子控件是否可以超出父控件范围显示,默认true(不可以)、false(可以),此属性一般用在爷爷级控件上效果比较明显,例如上面效果
layout_gravity控制超出的内容在哪块显示
Google对clipChildren属性的原文描述:
Freeline( Android平台上的秒级编译方案) 阿里巴巴出品,类似Instant Run功能;用了下确实比较爽而且免费推荐大家使用,以下为官方详细介绍
使用文档:https://www.freelinebuild.com/docs/
原理说明:https://yq.aliyun.com/articles/59122?spm=5176.100240.searchblog.56.Sqd0hT
底部导航栏按钮突出,先上效果图
之前项目做法:RelativeLayout+RadioGroup+ImageView/TextView
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <View android:layout_width="match_parent" android:layout_height="match_parent" android:layout_above="@+id/radiogroup" android:background="@color/yellow" /> <RadioGroup android:id="@+id/radiogroup" android:layout_width="match_parent" android:layout_height="50dp" android:layout_alignParentBottom="true" android:background="@color/white" android:orientation="horizontal"> <RadioButton android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:button="@null" android:gravity="center" android:text="首页" /> <RadioButton android:layout_width="0dp" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:layout_weight="1" android:button="@null" android:gravity="center" /> <RadioButton android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:button="@null" android:gravity="center" android:text="我的" /> </RadioGroup> <TextView android:layout_width="wrap_content" android:layout_height="60dp" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:layout_gravity="center_horizontal" android:background="@mipmap/index_investbtn_bg" android:button="@null" android:gravity="center" android:text="发现" /> </RelativeLayout>
现在做法:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" **android:clipChildren="false"** android:orientation="vertical"> <View android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:background="@color/yellow" /> <RadioGroup android:id="@+id/radiogroup" android:layout_width="match_parent" android:layout_height="50dp" android:background="@color/white" android:orientation="horizontal"> <RadioButton android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:button="@null" android:gravity="center" android:text="首页" /> <RelativeLayout android:layout_width="0dp" android:layout_height="60dp" android:layout_gravity="bottom" android:layout_weight="1"> <TextView android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_centerHorizontal="true" android:background="@mipmap/index_investbtn_bg" android:gravity="center" android:text="发现" /> </RelativeLayout> <RadioButton android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:button="@null" android:gravity="center" android:text="我的" /> </RadioGroup> </LinearLayout>
主要是使用了clipChildren属性,设置子控件是否可以超出父控件范围显示,默认true(不可以)、false(可以),此属性一般用在爷爷级控件上效果比较明显,例如上面效果
layout_gravity控制超出的内容在哪块显示
Google对clipChildren属性的原文描述:
相关文章推荐
- Android --中间突出的底部导航栏布局简单实现
- android 底部按钮图片突出显示,只要一个属性即可搞定!!
- android底部栏中间按钮突出
- Android客制化------6.0底部导航栏增加隐藏按钮
- Android 底部导航栏中间凸起、动态配置替换底部导航栏Tab图标(按钮、标签)的实现方案
- android顶部和底部导航栏
- Android - 保持在底部的按钮栏,上面是滚动的ScrollView
- Android应用底部导航栏(选项卡)实例
- 【android中级】之Android应用底部导航栏(选项卡)实例
- android中listView下有Button按钮始终在最底部
- Android应用底部导航栏(选项卡)实例
- android 让一个控件按钮居于底部的几种方法
- Android应用底部导航栏(选项卡)实例
- 程序猿媛二:Android底部导航栏(选项卡)
- android 让一个控件按钮居于底部的几种方法
- Android - 保持在底部的按钮栏,上面是滚动的ScrollView
- android 让一个控件按钮居于底部的几种方法
- Android应用底部导航栏(选项卡)实例
- 三步搞定ANDROID应用底部导航栏
- android底部导航栏