2017-07-09 6 views
0

私のアプリケーションでは、ImageViewTextViewRecyclerView以上のようなビューをスクロールビューで使用したいと考えています。
AndroidのRelativeViewでscrollViewを使用する方法

私は以下のコードを書いていますが、私には表示しませんRecyclerView

マイコード:

<?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"> 

    <RelativeLayout 
     android:id="@+id/miniFullSearch_toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="@dimen/size50" 
     android:background="@color/colorPrimary"> 

     <ImageView 
      android:id="@+id/miniFullSearch_toolbarBack" 
      android:layout_width="@dimen/size30" 
      android:layout_height="@dimen/size30" 
      android:layout_centerVertical="true" 
      android:layout_marginLeft="@dimen/padding10" 
      android:alpha="0.8" 
      android:padding="@dimen/padding5" 
      android:src="@drawable/back_arrow_image" /> 

     <EditText 
      android:id="@+id/miniFullSearch_toolbarText" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_margin="@dimen/padding5" 
      android:layout_toRightOf="@+id/miniFullSearch_toolbarBack" 
      android:alpha="0.8" 
      android:background="@android:color/transparent" 
      android:hint="@string/search" 
      android:textColor="@color/white" 
      android:textColorHint="@color/lightGray" 
      android:textSize="@dimen/font14" /> 

    </RelativeLayout> 

    <RelativeLayout 
     android:id="@+id/fullSearchMini_celebritiesLay" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_below="@+id/miniFullSearch_toolbar"> 

     <RelativeLayout 
      android:id="@+id/fullSearchMini_celebritiesHeaderLay" 
      android:layout_width="match_parent" 
      android:layout_height="@dimen/size50"> 

      <TextView 
       android:id="@+id/fullSearchMini_celebritiesHeaderTitle" 
       android:layout_width="wrap_content" 
       android:layout_height="match_parent" 
       android:layout_margin="@dimen/padding10" 
       android:fontFamily="sans-serif-light" 
       android:gravity="center_vertical" 
       android:text="@string/celebrities" 
       android:textColor="@color/darkBlueGrey" 
       android:textSize="@dimen/font16" /> 

      <RelativeLayout 
       android:id="@+id/fullSearchMini_celebritiesHeaderLoadMore" 
       android:layout_width="wrap_content" 
       android:layout_height="match_parent" 
       android:layout_alignParentRight="true" 
       android:layout_margin="@dimen/padding10" 
       android:gravity="center_vertical"> 

       <ImageView 
        android:id="@+id/fullSearchMini_celebritiesHeaderLoadMoreImage" 
        android:layout_width="@dimen/size20" 
        android:layout_height="@dimen/size20" 
        android:layout_alignParentRight="true" 
        android:layout_centerVertical="true" 
        android:src="@drawable/ic_next" 
        android:tint="@color/darkBlueGrey" /> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="match_parent" 
        android:layout_marginRight="@dimen/padding5" 
        android:layout_toLeftOf="@+id/fullSearchMini_celebritiesHeaderLoadMoreImage" 
        android:fontFamily="sans-serif-light" 
        android:gravity="center_vertical" 
        android:text="@string/loadMore" 
        android:textColor="@color/darkBlueGrey" 
        android:textSize="@dimen/font14" /> 

      </RelativeLayout> 

      <android.support.v7.widget.RecyclerView 
       android:id="@+id/fullSearchMini_celebritiesRecyclerView" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:layout_below="@+id/fullSearchMini_celebritiesHeaderLoadMore" /> 

     </RelativeLayout> 

    </RelativeLayout> 

</RelativeLayout> 

なぜ私が表示されないrecyclerView?

答えて

0

あなたはこのようにそれを実行します。

<NestedScrollView> 
    <RelativeLayout> 
    //All other views 
    <RecyclerView> 
    </RelativeLayout> 
</NestedScrollView> 

あなたはnestedScrollView内側に一つだけ子のレイアウトを持っていることを確認してください。

第二に私はあなたがこのことができます。この

ViewCompat.setNestedScrollingEnabled(recylerView,false); 

希望を行うことをお勧めします。

関連する問題