Android是没有选择正确的布局文件 [英] Android is not choosing the correct layout file

查看:128
本文介绍了Android是没有选择正确的布局文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有3个不同的布局文件

I have 3 different layout files

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

我的Nexus 7总是使用布局/ main.xml中

有什么我必须做的就是它使用布局sw600dp / main.xml中文件?

Is there something I have to do to get it to use the layout-sw600dp/main.xml file?

推荐答案

该文档没有提到它,但你必须有支持屏树立正确的AndroidManifest.xml中

The docs didn't mention it but you have to have the supports-screens set up right in 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>

这篇关于Android是没有选择正确的布局文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆