2017-10-18 1 views
0

私は、画面の下部に固定されたマップを表示し、その前にスクロールを許可するScrollViewを必要とします。問題は、x個以上のTextViewが(ScrollView内に)存在すると、マップが画面から消えてしまい、スクロールしても表示できないということです。どうすれば私のレイアウトの一番下に常にGoogleマップのビューを表示させることができますか?

私はこのようなのMapView TextViewsとし、最後にいくつかのLinearLayoutsを含むScrollView持っている: `

  ... 

      <LinearLayout 
       android:id="@+id/details_neighbours_layout" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:minHeight="@dimen/details_separator_height" 
       android:orientation="horizontal" 
       android:padding="@dimen/historic_margin_separator_medium" 
       android:visibility="gone" 
       android:weightSum="3"> 

       <TextView 
        android:id="@+id/neighbours_title" 
        android:layout_width="0dip" 
        android:layout_height="match_parent" 
        android:layout_weight="1" 
        android:text="@string/neighbours" 
        android:textColor="@color/color_light_grey_text" 
        android:textSize="@dimen/primary_text_size" 
        android:textStyle="bold" /> 

       <TextView 
        android:id="@+id/neighbours_text" 
        android:layout_width="0dip" 
        android:layout_height="match_parent" 
        android:layout_weight="2" 
        android:gravity="center_vertical|right" 
        android:paddingLeft="4dp" 
        android:text="" 
        android:textColor="@color/color_light_grey_text" 
        android:textSize="@dimen/tertiary_text_size" /> 
      </LinearLayout> 
     </LinearLayout> 
    </ScrollView> 
</LinearLayout> 

<!-- Map view --> 
<com.google.android.gms.maps.MapView 
    android:id="@+id/map_view" 
    android:layout_width="match_parent" 
    android:layout_height="0dip" 
    android:layout_weight="1" 
    android:visibility="visible"/> 

答えて

1

あなたは以下のコードを試すことができます。

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

    <ScrollView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:orientation="vertical" 
      android:weightSum="1"> 

      <LinearLayout 
       android:id="@+id/details_neighbours_layout" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_weight=".2" 
       android:orientation="horizontal" 
       android:weightSum="3"> 

       <TextView 
        android:id="@+id/neighbours_title" 
        android:layout_width="0dip" 
        android:layout_height="match_parent" 
        android:layout_weight="1" 
        android:text="abc" 
        android:textStyle="bold" /> 

       <TextView 
        android:id="@+id/neighbours_text" 
        android:layout_width="0dip" 
        android:layout_height="match_parent" 
        android:layout_weight="2" 
        android:gravity="center_vertical|right" 
        android:paddingLeft="4dp" 
        android:text="xyz" /> 
      </LinearLayout> 
     </LinearLayout> 
    </ScrollView> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true"> 

     <com.google.android.gms.maps.MapView 
      android:id="@+id/map_view" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:visibility="visible" /> 

    </LinearLayout> 

</RelativeLayout> 
0

親としてRelativeLayoutを使用し、その後、atribute

alignParentBottom=true 

これとのMapViewを追加他の属性によって結果が得られるはずです。

0

はこれを試してみてください。

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
      xmlns:app="http://schemas.android.com/apk/res-auto" 
      xmlns:card_view="http://schemas.android.com/tools" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:orientation="vertical"> 

      <ScrollView 
      android:layout_width="match_parent" 
      android:layout_height="0dp" 
      android:layout_weight="1" 
      android:scrollbars="none" 
      > 
      <!-- Your TextViews --> 
     </ScrollView> 

     <com.google.android.gms.maps.MapView 
      android:id="@+id/map_view" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      /> 

関連する問題