<Android> 利用RelativeLayout实现中间控件长度自适应
来源:互联网 发布:淘宝给差评被报复 编辑:程序博客网 时间:2024/05/22 04:33
有三个控件,两个Button, 一个SeekBar,实现SeekBar在两个Button中间,长度自适应。
如图:
如果使用LinearLayout则需要指定SeekBar的长度,用RelativeLayout则可以通过:
Button1紧靠Parent的右边,Button2紧靠左边,SeekBar设置为靠Button1的左边,Button2的右边,
可实现我们所需要的布局。
<RelativeLayout android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content"> <Button style="?android:attr/buttonStyleSmall" android:layout_width="50dp" android:layout_height="wrap_content" android:text="@string/menu_fontminus" android:layout_alignParentLeft="true" android:layout_marginLeft="10dp" android:id="@+id/btn_fontminus"/> <Button style="?android:attr/buttonStyleSmall" android:layout_width="50dp" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_alignBottom="@id/btn_fontminus" android:layout_marginRight="10dp" android:text="@string/menu_fontplus" android:id="@+id/btn_fontplus"/> <SeekBar android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toLeftOf="@id/btn_fontplus" android:layout_toRightOf="@id/btn_fontminus" android:layout_alignBottom="@id/btn_fontplus" android:layout_marginBottom="5dp" android:id="@+id/seekbar_font"/></RelativeLayout>
效果图:
0 0
- <Android> 利用RelativeLayout实现中间控件长度自适应
- Android布局:两边控件长度固定,中间控件长度自适应
- Android RelativeLayout中实现控件平分屏幕
- Android RelativeLayout中实现控件平分屏幕
- android备份短信到xml文件,并且利用回调函数实现自适应不同的控件
- Android控件 - RelativeLayout 简介
- Android RelativeLayout一个靠左靠右靠中间的listview
- 用RelativeLayout实现上下控件高度不变,中间的控件高度随着屏幕高度变化,适应整个屏幕
- android RelativeLayout控件或view实现叠加效果
- RelativeLayout(Android)中实现控件平分屏幕
- Android布局控件之RelativeLayout
- 实现三栏布局中间自适应
- css实现两边固定,中间自适应
- android 上中下布局,中间自适应
- 三栏自适应布局实现(左右固定宽度,中间自适应)
- 实现2边固定长度,中间可变长度的办法
- android-RelativeLayout实现水平布局
- RelativeLayout布局下实现控件平分空间
- table css
- Java中求List<double[]>中的最大值和最小值
- Linux用户管理
- 使用点对点信道的数据链路层
- URL 多线程下载
- <Android> 利用RelativeLayout实现中间控件长度自适应
- Repeated DNA Sequences
- Laravel 4 验证
- 【.NET机房重构】——回头看看走过的路
- [leetcode oj 171] Excel Sheet Column Number
- linux mysql定时备份并压缩
- 计算安全和无条件安全
- 【机房重构】——报表实现
- vim配置