简体   繁体   English

Android上的底栏

[英]Bottom bar on Android

如何在屏幕顶部占据大部分视图并且屏幕底部有一个位于其下方的底栏,而不直接设置顶视图的大小?

You can set the top View's android:layout_weight set to "1", then you can set your bottom View's height and the top View will take up all remaining space. 您可以将顶部View的android:layout_weight设置为“1”,然后您可以设置底部View的高度,顶部View将占用所有剩余空间。 For example: 例如:

<LinearLayout android:layout_width="fill_parent"
    android:layout_height="wrap_content" android:layout_weight="1" />
<LinearLayout android:layout_width="fill_parent"
    android:layout_height="25dip" />

(Of course, if there is content in the bottom View, you can just set the height to "wrap_content" and have it set its own size based on its contents.) (当然,如果底部视图中有内容,您可以将高度设置为“wrap_content”,并根据其内容设置自己的大小。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM