Ski*_*zit 3 android android-layout
是否可以让布局占据一定比例的屏幕空间?
我目前有2种布局,其中一种占据大约130dip的高度,这对于大多数屏幕来说都很好,但是当我切换到横向时,在某些屏幕尺寸上几乎看不到其他线性布局。我如何确保每个屏幕都具有相等的屏幕空间?
为每个布局设置相同的值android:layout_weight。
例:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout android:layout_width="fill_parent" android:layout_height="0dp"
android:layout_weight="1" android:background="#FF0000" />
<LinearLayout android:layout_width="fill_parent" android:layout_height="0dp"
android:layout_weight="1" android:background="#0000FF" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3158 次 |
| 最近记录: |