android - 针对不同设备应用分辨率

标签 android resolution screen-resolution device

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

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

谢谢!

最佳答案

这只是一个例子:

设备分辨率-

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" />

关于android - 针对不同设备应用分辨率,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19065701/

相关文章:

javascript - Ionic 应用程序中的屏幕尺寸错误

安卓蓝牙通知

android - 在 pressback 上停止 fragment 中的视频播放器

android-layout - 钛处理不同的分辨率

Java 应用程序自动调整大小以适应屏幕分辨率

delphi - 获取 Delphi (DirectX) 中所有显示器的当前/ native 屏幕分辨率

java - 防止 DialogFragment 将应用程序发送到节能模式

android - Firebase:如何实时捕获数据

git - 在给定 merge 提交 SHA1 的情况下,您如何查看/显示已完成的 git merge 冲突解决方案?

ffmpeg - 不同的视频播放器在 ffmpeg 转换后显示不正确的 mp4 分辨率