2013-09-28 35 views
2

我一直在试图设置一个设备阵列的屏幕分辨率,我已经看了所有的答案,并从我理解如果我创建一个res/layout-normal,res/layout-large和所以我可以把调整后的布局放在那里,应用程序会自动加载它们。适用于不同设备的分辨率

如何过这并没有发生...... 可以有人请解释一下刚才我已经创建了布局和布局文件夹 ,允许使用各种规模的在我的XML后做什么(虽然我认为默认是所有)。

谢谢!

+0

你有没有看着[支持多种屏幕(http://developer.android。 COM /引导/做法/ screens_support.html)? – Rajesh

+0

我有,我只需要一个实现来排序在我脑海中的东西我猜...我只是不知道如何连接他们...我也看到了代码来检查你的决议,但我怎么能区分不同的布局同名... –

+0

将不同的背景颜色添加到相同的名称布局,以便您可以轻松地知道哪一个正在加载。 – Swetank

回答

2

它只是一个例子:

设备与分辨率

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

http://developer.android.com/training/multiscreen/screensizes.html,http://developer.android.com/training/multiscreen /screendensities.html,http://developer.android.com/guide/practices/tablets-and-handsets.html也检查这些链接。 –

+0

那么真的不需要实现任何代码?只需创建维度,应用程序将自动检查应用哪种暗淡模式? –

+1

检查此:http://stackoverflow.com/questions/9877946/text-size-and-different-android-screen-sizes –