如何设置图层的大小百分比?
问题描述:
我现在使用dip。但在具有mdpi,hdpi,xhdpi ...比例的设备上有所不同。例如: 如何设置图层的大小百分比?
我知道在mdpi 1px = 1dp。 华电国际1.00dp = 1.50px xhdpi 1.00dp = 2.00px
在高分辨480x800的华电国际,上xhdi usualy 720x1280 ... DP是没用的
答
使用android:layout_weight="25"
,继续等,并依此类推,直到你在你的LinearLayout
完成所有项目。
因此,例如:
android:layout_weight="25"
android:layout_weight="15"
android:layout_weight="50"
android:layout_weight="35"
答
你无法提及百分比维度。
相反,您可以在LinearLayout中使用android:layout_weight
属性。
阅读:为25%的项目What does android:layout_weight mean?
答
你应该用 '机器人:layout_weight' PARAM LinearLayout
孩子:
<LinearLayout>
<View
android:layout_height="0dp"
android:layout_width="fill_parent"
android:layout_weight="25" />
<View
android:layout_height="0dp"
android:layout_width="fill_parent"
android:layout_weight="15" />
<View
android:layout_height="0dp"
android:layout_width="fill_parent"
android:layout_weight="50" />
<View
android:layout_height="0dp"
android:layout_width="fill_parent"
android:layout_weight="35" />
</LinearLayout>