[英]How to add more dimens.xml files in android?
我的xml
文件中有一個用於UI
的LinearLayout
。
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="170dp"
android:gravity="center_vertical|center_horizontal">
<ImageView
android:layout_width="fill_parent"
android:layout_height="70dp"
android:gravity="center_horizontal|center_vertical"
android:src="@drawable/menu_profile_icon" />
</LinearLayout>
我在dp
指定了Layout
的height
。 我的 GUI 在不同的emulators
是不同的。 它在Nexus 5 emulator
很好,但在Nexus S emulator
它不正確。 我的LinearLayout
在Nexus S emulator
不在屏幕上。 它的解決方案是什么?
我也試過用sp
,但沒用,
謝謝你。
android系統會根據設備特性從“values”文件夾中選擇正確的dimens.xml。
一些特點:
示例:設備 A 是具有大屏幕的 HDPI。
文件夾名稱應為:
值-大-hdpi
您必須為每個集合構建具有特定值的維度。
像大屏幕和 XHDPI 的一組設備。
http://developer.android.com/guide/practices/screens_support.html http://developer.android.com/guide/topics/resources/available-resources.html
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.