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"

>

更多相关文章

  1. Android中定义数组与使用
  2. Android(安卓)性能优化的一些方法
  3. Android(安卓)Google Map V2 备忘
  4. Android(安卓)利用隐藏API实现屏幕亮度调节
  5. Android开发中修改程序字体
  6. Android(安卓)数据库Sqlite的使用(1)
  7. Android——SQLite使用
  8. 我的Android第一步
  9. Kotlin 写 Android(安卓)单元测试(二),JUnit 4 测试框架和 kotlin.t

随机推荐

  1. PHP结合Redis来限制用户或者IP某个时间段
  2. PHP替换标签字符
  3. 单击保存按钮(PHP和MSQL)时如何保存记录列
  4. 根据网址上的国家/地区将用户重定向到正
  5. 今天开始学php,第一次写博客以鼓励自己能
  6. smarty模板引擎变量的传递方法
  7. 获取所有网站的错误,[重复]
  8. jquery ajax在调用之后将无法工作
  9. 在Capistrano任务中引用当前服务器
  10. 在simplexml_load_file中加载url时出错