【问题标题】:applying resolution for different devices为不同的设备应用分辨率
【发布时间】:2013-09-28 10:05:05
【问题描述】:

我一直在尝试为一系列设备设置屏幕分辨率,我已经查看了所有答案,并且根据我的理解,如果我创建了 res/layout-normal、res/layout-large 等等,我可以放在那里调整布局,应用程序将自动加载它们。

这怎么没有发生... 有人可以解释一下我创建布局和布局文件夹后要做什么吗 并允许在我的 XML 中使用所有尺寸(尽管我认为默认是所有尺寸)。

谢谢!

【问题讨论】:

  • 我有,我只需要一个实现来整理我的脑海中的事情我猜...我只是不知道如何连接它们...我也看到了代码来检查你的分辨率但是我如何区分具有相同名称的不同布局...
  • 为同名布局添加不同的背景色,让您轻松知道加载的是哪一个。
  • 不是重复的:) 但这是一个很好的解释...

标签: android resolution screen-resolution device


【解决方案1】:

这只是一个例子:

设备分辨率-

res/values/dimens.xml(default)

res/values-ldpi/dimens.xml (240*320 and nearer resolution)

res/values-mdpi/dimens.xml (320*480 and nearer resolution)

res/values-hdpi/dimens.xml (480*800 and nearer resolution)

res/values-xhdpi/dimens.xml (720*1280 Samsung s3,Micromax HD canvas etc)

res/values-xxhdpi/dimens.xml (1080*1920 samsung s4,HTC one etc)

平板分辨率-

res/values-sw600dp/dimens.xml (600*1024)

res/values-sw720dp-land/dimens.xml (800*1280)

<TextView
    android:id="@+id/textView1"
    style="@android:style/TextAppearance.Small"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Sample Text - Small" />
<TextView
    android:id="@+id/textView2"
    style="@android:style/TextAppearance.Medium"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Sample Text  - Medium" />
<TextView
    android:id="@+id/textView3"
    style="@android:style/TextAppearance.Large"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Sample Text  - Large" />

【讨论】:

猜你喜欢
  • 2011-09-05
  • 1970-01-01
  • 2020-09-02
  • 1970-01-01
  • 2016-10-05
  • 2017-06-06
  • 1970-01-01
  • 1970-01-01
  • 2023-01-28
相关资源
最近更新 更多