我是Android新手,并尝试学习如何使用多个布局文件夹为不同大小的设备指定不同的布局.
我尝试了一些不同的东西,但似乎没有什么能让我的模拟平板电脑使用更大的布局.
我的布局目录结构是:
"布局"中的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>
Run Code Online (Sandbox Code Playgroud)
其他三个文件夹中的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>
Run Code Online (Sandbox Code Playgroud)
模拟器设置正在尝试模拟Google Nexus 7:
有谁知道为什么这不起作用?
谢谢您的帮助!