2016-09-15 9 views
0

下のシートのレイアウトファイルは以下のとおりです。入れ子になったスクロールビューの下にTextViewがあります。コンテンツが大きい場合は、NestedScrollView以下のTextViewは表示されません。 NestedScrollViewのコンテンツが小さい場合は、それが表示されます。私はこれを引き起こしているものを得ていない。下のテキストビューNrapScrollViewの高さがwrap_contentで表示されない

<LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:background="@color/white" 
     android:orientation="vertical"> 

     <android.support.v7.widget.Toolbar 
      android:id="@+id/bottom_sheet_toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="?attr/actionBarSize" 
      android:paddingLeft="@dimen/activity_horizontal_margin" 
      android:paddingRight="@dimen/activity_horizontal_margin" 
      app:popupTheme="@style/AppTheme.PopupOverlay" 
      app:title="My Title"> 

      <ImageView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_gravity="end" 
       android:background="?attr/selectableItemBackgroundBorderless" 
       android:onClick="@{() -> handler.hideBottomSheet()}" 
       android:src="@drawable/ic_keyboard_arrow_down_black_24dp" /> 

     </android.support.v7.widget.Toolbar> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:orientation="vertical" 
      android:paddingLeft="@dimen/activity_horizontal_margin" 
      android:paddingRight="@dimen/activity_horizontal_margin"> 

      <RadioGroup 
       android:id="@+id/selection_mode" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginBottom="10dp" 
       android:checkedButton="@+id/mode_1" 
       android:gravity="center" 
       android:orientation="horizontal"> 

       <RadioButton 
        android:id="@+id/mode_1" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="@string/mode_1" /> 

       <RadioButton 
        android:id="@+id/mode_2" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="@string/mode_2" /> 

      </RadioGroup> 

      <android.support.v4.widget.NestedScrollView 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content"> 

       <LinearLayout 
        android:id="@+id/list_container" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:orientation="vertical" /> 

      </android.support.v4.widget.NestedScrollView> 

      <TextView 
       android:id="@+id/list_description" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginBottom="20dp" 
       android:layout_marginTop="10dp" 
       android:gravity="center" 
       android:text="This text is not visible. I dunno why! :/" /> 

     </LinearLayout> 

    </LinearLayout> 
</FrameLayout> 

list_container LinerLayoutがランタイムに膨張さ:

は、ここに私のレイアウトファイルです。 RecyclerViewまたはListViewを使用していない理由がいくつかあります。これはかなり小さいですが、いつか少しスクロールします。

list_containerが大きい場合(スクロールが必要な場合)、TextView list_descriptionは表示されません。

私は何がうまくいかないのですか?

答えて

1

NestedScrollViewandroid:layout_weightをお試しください。あなたのケースでは

、とあなたNestedScrollViewのヘッダーを置き換える:

<android.support.v4.widget.NestedScrollView 
       android:layout_width="match_parent" 
       android:layout_height="0dp" 
       android:layout_weight="1" 

恐ろしい=]

+1

を役に立てば幸い!それはうまくいった!ありがとう! – kirtan403

関連する問題