2017-07-08 17 views
0

私はscrollViewの中にカードビューを示していますが、その下にcardviewの下にカードビューを示しています。listviewまたはrecyclerviewを入れる必要があります。問題は、メインスクロールと調整するために、そのリストのスクロールが必要なことです。 Oseaは内容が低くなるとcardviewが消え、recyclerviewまたはlistviewのリストを越えます。Scrollview内の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

は、RecyclerViewにヘッダを追加し、ここで参照するには多くの方法があります。つまり、 'ScrollView'内の' ListView'です。 'NestedScrollView'と' RecyclerView'を使用する必要がある場合。 – Sharj

答えて

2

NestedScrollview中にあなたrecyclerviewを追加します。 さらに、recyclerview.setNestedScrollingEnabled(false)を追加します。

0

android:fillViewport = "true"をScrollViewに使用します。 ScrollView内にあるListViewは正常に動作します。

<ScrollView 
android:id="@+id/scrollView" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:fillViewport="true"> 
0

私はヘッダとしてRecyclerViewCardViewを置くことをお勧めしたい、とあなたはトップScrollViewを必要としない、カードとリスト項目は、すべてのRecyclerView内スクロール可能になります。あなたが別の内1つのスクロールビューを置くべきではありません Is there an addHeaderView equivalent for RecyclerView?

関連する問題