2017-07-08 64 views
0

我有这个活动的设计,它显示了一个scrollView内的卡片视图,但在那个cardview我需要把listviewrecyclerview。问题是我需要该列表的滚动来与主滚动进行协调。 Osea认为,当内容较低时,cardview将消失,并且recyclerview或listview的列表将被越过。滚动视图内的Recyclerview不协调

我需要所有的内容来响应主滚动显示和消失后titlebar,我应该改变或重新设计?

Captura de Imagen

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


    <android.support.v7.widget.CardView 
     app:cardElevation="5dp" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 

     <android.support.design.widget.CoordinatorLayout 
      android:id="@+id/post_coordinator" 
      android:orientation="vertical" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 

      <ImageView 
       android:id="@+id/post_bg" 
       android:layout_width="match_parent" 
       android:layout_height="150dp" 
       android:scaleType="fitXY" 
       android:src="@drawable/default_profile" /> 

      <android.support.design.widget.FloatingActionButton 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       app:fabSize="normal" 
       android:src="@drawable/ic_hot_black" 
       app:layout_anchorGravity="bottom" 
       android:layout_marginLeft="16dp" 
       app:layout_anchor="@id/post_bg" 
       android:tint="#FFF" 
       /> 

      <com.mikhaellopez.circularimageview.CircularImageView 
       android:layout_width="100dp" 
       android:layout_height="100dp" 
       app:layout_anchor="@id/post_bg" 
       app:layout_anchorGravity="center_horizontal|bottom" 
       android:src="@drawable/profile" 
       app:civ_border_color="#FFF" 
       app:civ_border_width="3dp" 
       /> 


      <android.support.design.widget.FloatingActionButton 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       app:fabSize="normal" 
       android:src="@drawable/ic_hot_black" 
       app:layout_anchorGravity="bottom|end" 
       android:layout_marginRight="16dp" 
       app:layout_anchor="@id/post_bg" 
       android:tint="#FFF" 
       /> 


      <LinearLayout 
       android:orientation="vertical" 
       android:layout_width="match_parent" 
       android:layout_marginTop="205dp" 
       android:paddingLeft="20dp" 
       android:paddingRight="20dp" 
       android:paddingBottom="50dp" 
       android:layout_height="wrap_content"> 


       <TextView 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:text="Prepare your Anus Cersei Lanister, You Gonna Die" 
        android:textAppearance="@style/Base.TextAppearance.AppCompat.Large" 
        android:textColor="#2d2d2d" 
        android:textAlignment="center" 
        /> 


       <TextView 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:textAlignment="center" 
        android:text="@string/emilia" 
        android:textColor="@color/secondary_text" 
        android:layout_marginTop="10dp" 
        /> 

      </LinearLayout> 

     </android.support.design.widget.CoordinatorLayout> 

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


    <ListView 
     android:id="@+id/post_comments" 
     android:layout_marginTop="16dp" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     > 
    </ListView> 

    </LinearLayout> 
</ScrollView> 
+1

你不应该把内另一个滚动视图。即:'ScrollView'中的'ListView'。如果你必须使用'NestedScrollView'和'RecyclerView'。 – Sharj

回答

2

里面添加NestedScrollview您recyclerview。 另请添加recyclerview.setNestedScrollingEnabled(false);

0

对你的ScrollView使用android:fillViewport =“true”。位于ScrollView内的ListView能正常工作。

<ScrollView 
android:id="@+id/scrollView" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:fillViewport="true"> 
相关问题