LinearLayout中的控件两端对齐 或 Button、TextView左右对齐
2015-10-30 10:13
363 查看
在android中的控件LinearLayout 中的android:gravity="center" 属性,要么是居左、居右、居中对齐,不能达到双控件 两端对齐,要实现两端对齐方式,要采用 中间增加一个控件的方式实现 ,并设置属性weight=1。
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:padding="10dp"> <TextView android:id="@+id/tv_name" style="@style/commanditem_name_tv"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" /> <com.dashuai.view.SwitchButton android:id="@+id/switch_com" style="@style/SwitchButtonStyle" android:layout_marginRight="10px"/> </LinearLayout>效果如图:
相关文章推荐
- cocos2dx截图
- AStar寻径算法
- VC如何实现按下回车后编辑框输入焦点传递到下一编辑框?
- UML视频
- machine ID 问题
- 009 The Interfaces In JAVA(官网文档翻译)
- MyEclipse非常方便的快捷键
- oracle数据迁移中的故障解决:
- 执行做jffs2的build.sh脚本错误————/usr/bin/ld: cannot find -lc
- Supporting Different Screen Sizes
- 单词翻转
- 微信支付app支付3.0接口开发
- php 连续留存与留存人数计算
- docker详细的基础用法
- Day7.2 计算机中的进制
- 51nod 1089 最长回文子串 V2 (Manacher算法)
- python第一章1.2 初步走进编程之门
- Java重写方法与初始化的隐患
- 【codevs1191】数轴染色 并查集
- 学习windows驱动(温习3)