Android 让UI控件固定于底部的几种方法
1.采用linearlayout布局:
android:layout_height="0dp" <!-- 这里不能设置fill_parent -->
android:layout_weight="1" <!-- 这里设置layout_weight=1是最关键的,否则底部的LinearLayout无法到底部 -->


2. 采用relativelayout布局:
android:layout_alignParentBottom="true" <!-- 这里设置layout_alignParentBottom=true是最关键的,这个属性上级必须是RelativeLayout -->

 

=====================================

布局xml代码如下:

1)采用linearlayout布局

<LinearLayout xmlns:andro />
    </LinearLayout>
</LinearLayout>

 

2)采用relativelayout布局

<RelativeLayout xmlns:andro/>
    </LinearLayout>
</RelativeLayout>

本博客地址: wukong1688

本文原文地址:https://www.cnblogs.com/wukong1688/p/10660549.html

转载请著名出处!谢谢~~

 

相关文章:

  • 2021-06-03
  • 2022-12-23
  • 2021-10-11
  • 2021-06-28
  • 2022-12-23
  • 2021-07-06
  • 2021-08-26
  • 2022-12-23
猜你喜欢
  • 2021-11-18
  • 2022-12-23
  • 2021-11-30
  • 2021-04-04
  • 2022-12-23
  • 2021-04-12
  • 2022-03-08
相关资源
相似解决方案