打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
android如何让控件摆放在屏幕底部

这个问题还是比较适合通过weight处理。
@张炎Lior的大体思路是正确的,如果你仅仅想让输入框那一行在下面,并且宽度随意增加,或者仅仅想让按钮显示出来,那么就不要设置weight比例,直接就是1:0就好了,具体代码见下面:
权重值越小越先渲染

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3. android:orientation="vertical"
  4. android:layout_width="fill_parent"
  5. android:layout_height="fill_parent">
  6. <TextView android:text="welcome"
  7. android:id="@+id/TextView"
  8. android:layout_width="fill_parent"
  9. android:layout_height="0dip"
  10. android:layout_weight="1">
  11. </TextView>
  12. <LinearLayout android:id="@+id/LinearLayout"
  13. android:orientation="horizontal"
  14. android:layout_width="fill_parent"
  15. android:layout_height="wrap_content"
  16. android:layout_weight="0">
  17. <EditText android:id="@+id/EditText"
  18. android:layout_width="0dip"
  19. android:layout_height="wrap_content"
  20. android:layout_weight="1">
  21. </EditText>
  22. <Button android:text="label_submit_button"
  23. android:id="@+id/Button"
  24. android:layout_width="wrap_content"
  25. android:layout_height="wrap_content"
  26. android:layout_weight="0">
  27. </Button>
  28. </LinearLayout>
  29. </LinearLayout>
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
Android开发:安卓版QQ登陆界面
Android:Layout_weight的深刻理解
android中关于scrollview内部组件android:layout
Android开发笔记(四)— 对控件的简单操作
怎么给android 设置边框(tableLayout、表格)
防止UI界面被输入法遮挡(画面随输入法自适应)
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服