2013-11-22 113 views
0

我一直在寻找这个东西,并且我遵循Android支持多屏幕的文档。我有我的手机是mdpi,是320x480。我也有我的平板电脑是mdpi,并且是600x976。我在我的drawable-mdpi/myimg.png中有一个图像(320x581),在我的drawable-hdpi/myimg.png中有一个图像(640x1162)。我也有layout/mylayout.xml和layout-large/mylayout.xml。所以我的问题是,为什么我的平板电脑不显示全屏图像,因为我期待图像将覆盖整个屏幕?任何帮助将非常感激。 下面是我的布局layout/mylayout.xml和layout-large/mylayout.xml的代码。手机和平板电脑android的布局

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" > 
<ImageView 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:background="@drawable/myimg" 
android:layout_centerInParent="true"/> 
</RelativeLayout> 
+0

取决于你的布局如何看?如果您的布局限制到某个宽度,例如... – Nanne

+0

您需要从布局中提供圆顶代码示例。 – guydemossyrock

+0

'我的手机是mdpi,尺寸是320x480。我也有我的平板电脑这是mdpi和600x976' - 所以你如何期望它从hdpi文件夹中选择一个图像,因为这两个设备都是'mdpi' – mihail

回答

0

是什么让这种情况发生是添加绘制大型文件夹,用于平板电脑的图像。

0
//for phone 
use layout folder(for both land and portrait mode) 
//for tablet(7-inch) 
use layout-sw600dp-land(for landscape) 
use layout-sw600dp-port(for portrait) 
//for tablet(10-inch) 
use layout-sw720dp-land(for landscape) 
use layout-sw7200dp-port(for portrait) 

and draq 9-patch images using 
http://android-ui-utils.googlecode.com/hg/asset-studio/dist/nine-patches.html 
+0

感谢您的回答@iCodeAtAndroid。但我无法做出我想要发生的事情。我不想在myimg的宽度和高度上使用match_parent,因为我不希望它看起来像素化。因此,由于我的平板电脑(600x976)是mdpi,这是否意味着我的平板电脑使用的唯一图像是来自drawable-mdpi文件夹的图像? – kads