android控件两端对齐
2014-03-10 11:35
295 查看
开工玩android啦
记下自己玩android碰到各种问题,从视图布局开始!
同一行有两个不同类型的控件,要实现两端对齐效果:
使用相对布局:
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<CheckBox
android:id="@+id/savePwdBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="@string/login_is_savepwd" />
<Button
android:id="@+id/forgotPwdBtn"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:text="@string/login_forgot_pwd" />
</RelativeLayout>
红色是关键配置,保证了两个控件两端对齐时还能处在同一高度上。
记下自己玩android碰到各种问题,从视图布局开始!
同一行有两个不同类型的控件,要实现两端对齐效果:
使用相对布局:
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<CheckBox
android:id="@+id/savePwdBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="@string/login_is_savepwd" />
<Button
android:id="@+id/forgotPwdBtn"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:text="@string/login_forgot_pwd" />
</RelativeLayout>
红色是关键配置,保证了两个控件两端对齐时还能处在同一高度上。
相关文章推荐
- Android]TextView实现分散对齐(两端对齐)
- android 控件对齐方式
- android控件的对齐方式(转)
- android控件的对齐方式(转) layout
- android 控件对齐位置
- android控件的对齐方式
- android控件的对齐方式,控件布局(顶部、底部)留着自用~~~
- Android开发:文本实现两端对齐
- LinearLayout中的控件两端对齐
- Android实现TextView两端对齐的方法
- [Android][实现类似表单上的文字,两端对齐,文字间距相等]
- android控件的对齐方式(转)
- LinearLayout中的控件两端对齐
- Android 控件(button)对齐方法实现详解
- Android TextView两端对齐解决办法
- Android TextView两端对齐
- android中的两端对齐
- Android里XML布局字数不相等的时候怎么实现两端对齐?
- android控件的对齐方式
- Android 控件对齐方式