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"

>

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容