Android 让一个控件或布局居于底部的办法
android 让一个控件按钮居于底部的几种方法
1.采用linearlayout布局:
android:layout_height="0dp"
android:layout_weight="1"
2. 采用relativelayout布局:
android:layout_alignParentBottom="true"
3. 采用 fragment 布局(activitygroup 已经被弃用不建议使用)
=====================================
1.采用linearlayout布局:
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
android:id="@+id/content"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical">
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="bottom"
android:orientation="vertical">
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/runbackground"
android:focusable="false" />
2. 采用relativelayout布局:
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical">
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/runbackground"
android:focusable="false" />
3. 采用 fragment 布局(activitygroup 已经被弃用不建议使用)
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
android:layout_width="0px" android:layout_height="match_parent"
/>
android:background="?android:attr/detailsElementBackground"
>
更多相关文章
- Android再学习-20141018-布局-进度条
- android的五大布局
- Android随笔之布局属性简单用法
- Android学习―LinearLayout布局中实现左右对齐
- android相对布局 相对对齐
- Android常见布局控件之LinearLayout和TableLayout
- UI布局参数(持续更新)