5
Androidには新しく、複数のレイアウトフォルダを使用してさまざまなサイズのデバイスに異なるレイアウトを指定する方法を学びます。エミュレータの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>
他の3つのフォルダ内main.xmlです:
- ターゲット::のGoogle API(APIレベル16)
<?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のネクサス7をエミュレートしようとしています
これはなぜ動作しないのですか?
ありがとうございました!それはあなたの供給というレイアウト-大から選択されますので、
ネクサス7は、大tvdpiデバイスであります何がうまくいかないのですか? –
"layout-large"ディレクトリや "layout-sw600dp"ディレクトリではなく、標準の "layout"ディレクトリのmain.xmlを使用しています。 – user1563784
http://stackoverflow.com/ a/11735766/1012284 RUで抽象的なLCS密度を213dpiに設定することをお確かめください。 –