gpt4 book ai didi

android - 为不同的设备应用分辨率

转载 作者:行者123 更新时间:2023-11-29 00:26:23 25 4
gpt4 key购买 nike

我一直在尝试为一系列设备设置屏幕分辨率,我已经查看了所有答案,如果我创建一个 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com