在Android中为不同大小设置不同的布局

时间:2012-10-16 15:55:57

标签: java android android-layout

res/layout/main_activity.xml           
res/layout-small/main_activity.xml   
res/layout-large/main_activity.xml   
res/layout-xlarge/main_activity.xml
res/layout-xlarge-land/main_activity.xml

我有两个名称相同但内部文本消息不同的布局文件。当我尝试在Samsung-Galaxy 10.1 or Google Nexus 7英寸平板电脑或我的密度为1024dp * 600dp的模拟器中加载我的应用程序时,它总是加载res / layout / main_activity.xml

我不确定我在这里做错了什么。下面是清单文件。

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.sample"
    android:versionCode="2"
    android:versionName="2.3.4" >

    <uses-sdk
        android:minSdkVersion="11"
        android:targetSdkVersion="15" />

<supports-screens
        android:anyDensity="true"
        android:largeScreens="true"
        android:normalScreens="true"
        android:smallScreens="true" />


    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" >
        <activity
            android:name=".Splash"
            android:label="@string/title_activity_splash"
             >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity
            android:name=".Trial"
            android:label="@string/title_activity_trial"
            android:exported="false"
             >
            <intent-filter>
                <action android:name="com.sample.TRIAL" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

    </application>

</manifest>

我正在使用4.1.1.4版本的android.jar。

    <dependency>
        <groupId>com.google.android</groupId>
        <artifactId>android</artifactId>
        <version>4.1.1.4</version>
        <scope>provided</scope>
    </dependency>

1 个答案:

答案 0 :(得分:0)

根据this chart,1024x600被归类为xlarge。您的<support-screens>代码中没有提及xlarge。

相关问题