手机和平板电脑安卓的布局

时间:2013-11-22 10:39:40

标签: android

我一直在寻找这个东西,我已经在支持多个屏幕上遵循了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布局的代码。

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

2 个答案:

答案 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

答案 1 :(得分:0)

使这种情况发生的原因是为平板电脑的图像添加drawable-large文件夹。

相关问题