首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Android中为不同大小设置不同的布局

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

Stack Overflow用户
提问于 2012-10-16 23:55:57
回答 1查看 261关注 0票数 0
代码语言:javascript
复制
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

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

代码语言:javascript
复制
<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。

代码语言:javascript
复制
    <dependency>
        <groupId>com.google.android</groupId>
        <artifactId>android</artifactId>
        <version>4.1.1.4</version>
        <scope>provided</scope>
    </dependency>
EN

回答 1

Stack Overflow用户

发布于 2012-10-17 00:22:04

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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12918710

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档