2

私は次のレイアウトを持っています:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".MainActivity" >

    <fragment
        android:id="@+id/map"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        class="com.google.android.gms.maps.SupportMapFragment" />

    <TextView 
        android:text="Teste"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"/>

</LinearLayout >

地図はほぼフルスクリーンサイズで表示され、テキストビューは半分だけ表示されます。

画面の空きスペースだけをマップで埋めるにはどうすればよいですか? 他のビューに十分なスペースを確保しますか?

4

1 に答える 1

5

android:layout_height="0dp"で作成し、 からアトリビュート<fragment>を削除しandroid:layout_weightますTextView。次に、TextViewが自然な高さになり、マップが残りのスペースを占有します。

そうは言っても、おそらく の上余白が必要になるでしょうTextView。そのため、マップがテキストにはみ出さないようにする必要があります。

于 2013-06-09T18:22:46.200 に答える