5

我是 Android 新手,正在尝试学习如何使用多个布局文件夹为不同尺寸的设备指定不同的布局。

我尝试了一些不同的方法,但似乎没有什么能让我的模拟平板电脑使用更大的布局。

我的布局目录结构是:

  • 布局
  • 布局-大
  • 布局-sw600dp
  • 布局-xlarge

“布局”中的 main.xml 是

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
        >
    <SearchView android:id="@+id/searchView"
                android:iconifiedByDefault="false"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"/>

    <FrameLayout
            android:id="@+id/EarthquakeFragmentContainer"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            />
</LinearLayout>

其他三个文件夹中的main.xml是:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              android:orientation="horizontal">

    <SearchView android:id="@+id/searchView"
                android:iconifiedByDefault="false"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="#FFF"/>

    <fragment android:name="com.paad.earthquake.EarthquakeListFragment"
              android:id="@+id/EarthquakeListFragment"
              android:layout_width="360dp"
              android:layout_height="fill_parent"
            />

    <fragment android:name="com.paad.earthquake.EarthquakeMapFragment"
              android:id="@+id/EarthquakeMapFragment"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
            />

</LinearLayout>

模拟器设置正在尝试模拟 Google Nexus 7:

  • 目标:Google API(API 级别 16)
  • 皮肤:WXGA800-7in
  • SD卡:16M
  • 我正在使用皮肤附带的所有其他选项,以及 hw.keyboard=yes 和 hw.ramSize=512

有谁知道为什么这不起作用?

谢谢您的帮助!

4

1 回答 1

0

如果您使用的是 10" 平板电脑和 android 3.2 或更高版本,您应该有 layout-sw720dp 文件夹来保存您的布局文件

于 2015-05-28T10:55:14.120 回答