2012-12-29 21 views
0

我有3個不同的佈局文件Android是沒有選擇正確的佈局文件

layout/ 
    main.xml 
layout-large/ 
    main.xml 
layout-sw600dp/ 
    main.xml 

我的Nexus 7總是使用layout/main.xml

有什麼我必須做的就是它使用layout-sw600dp/main.xml文件?

+0

supports-screens樹立正確的你將不得不通過其他程序來改變密度和分辨率。我認爲有可能你也可以使用仿真器來設置這個參數。順便說一句,我做了一個簡單的應用程序來告訴你的密度,並顯示從資源中獲取的圖像。請檢查此,https://play.google.com/store/apps/details?id=m.mokrzycki.phoneifnormations我希望它會幫助你一些:) – deadfish

回答

2

該文檔沒有提到它,但你必須有在AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
     package="com.gpsinsight.gpsandroid"                
     android:versionCode="1" 
     android:versionName="1.0"> 
    <supports-screens 
     android:smallScreens="true" 
     android:normalScreens="true"  android:largeScreens="true" 
     android:xlargeScreens="true" /> 
    <application android:label="@string/app_name" android:icon="@drawable/ic_launcher"> 
     <activity android:name="MainActivity" 
        android:label="@string/app_name"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 
       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 
    </application> 
</manifest> 
+0

你有Sollution? –