簡體   English   中英

如何在android中添加更多的dimens.xml文件?

[英]How to add more dimens.xml files in android?

我的xml文件中有一個用於UILinearLayout

<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指定了Layoutheight 我的 GUI 在不同的emulators是不同的。 它在Nexus 5 emulator很好,但在Nexus S emulator它不正確。 我的LinearLayoutNexus S emulator不在屏幕上。 它的解決方案是什么?

我也試過用sp ,但沒用,

謝謝你。

android系統會根據設備特性從“values”文件夾中選擇正確的dimens.xml。

一些特點:

  1. 屏幕密度
  2. 屏幕尺寸
  3. 屏幕方向

示例:設備 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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM