2013-11-22 109 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