0
  • レイアウト+ページャ+リストビューを表示しようとしています。レイアウト+ページャーはうまく機能していますが、スクロールしないリサイクラビュー内のページャを表示します。おかげで私はrecyclearビューの高さを動的

    Layout + Viewpager + listview内にScrollviewを追加することは可能ですか?

  • 私のXMLコードをviewpager設定する方法

requirement Screenshot

  • -Advance私 を導く

  • ことが可能です... ...

    すべてのコピーの

    <ImageView 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:id="@+id/imageView3" 
        android:background="@drawable/profile" 
        android:layout_alignParentTop="true" 
        android:layout_alignParentStart="true" 
        android:layout_marginTop="27dp" /> 
    
    
    
    <android.support.design.widget.TabLayout 
        android:id="@+id/tabs" 
        android:layout_width="match_parent" 
        android:layout_height="?attr/actionBarSize" 
        app:tabMode="fixed" 
        app:tabGravity="fill" 
        app:tabTextColor="@color/your_unselected_text_color" 
        app:tabSelectedTextColor="@color/your_selected_text_color" 
        android:layout_below="@+id/imageView3" 
        android:layout_alignParentStart="true" /> 
    
    
    <android.support.v4.view.ViewPager 
        android:id="@+id/viewpager" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:layout_alignBottom="@+id/tabs" 
        android:layout_alignParentStart="true"> 
    
    </android.support.v4.view.ViewPager> 
    
    <android.support.v7.widget.RecyclerView 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:id="@+id/android.support.v7.widget.RecyclerView" 
        android:layout_alignParentBottom="true" 
        android:layout_alignParentStart="true"> 
    
    </android.support.v7.widget.RecyclerView> 
    </LinearLayout> 
    

+0

?スクロールビューを使用する代わりに試してみましょうサポートライブラリのネストされたスクロールビュー – Seaskyways

+0

再生のためのtq @ Seaskywaysとumair mansuri..please chckは私の質問を編集しました –

答えて

0

まず、プロジェクトでこのクラスファイル

import android.content.Context; 
import android.util.AttributeSet; 
import android.view.ViewGroup; 
import android.widget.ListView; 

public class ExpandableHeightListView extends ListView { 

boolean expanded = false; 

public ExpandableHeightListView(Context context) { 
    super(context); 
} 

public ExpandableHeightListView(Context context, AttributeSet attrs) { 
    super(context, attrs); 
} 

public ExpandableHeightListView(Context context, AttributeSet attrs, 
           int defStyle) { 
    super(context, attrs, defStyle); 
} 

public boolean isExpanded() { 
    return expanded; 
} 

@Override 
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 
    if (isExpanded()) { 
     // Calculate entire height by providing a very large height hint. 
     // View.MEASURED_SIZE_MASK represents the largest height possible. 
     int expandSpec = MeasureSpec.makeMeasureSpec(MEASURED_SIZE_MASK, 
       MeasureSpec.AT_MOST); 
     super.onMeasure(widthMeasureSpec, expandSpec); 

     ViewGroup.LayoutParams params = getLayoutParams(); 
     params.height = getMeasuredHeight(); 
    } else { 
     super.onMeasure(widthMeasureSpec, heightMeasureSpec); 
    } 
} 

public void setExpanded(boolean expanded) { 
    this.expanded = expanded; 
} 
} 

次に、この

<ScrollView ...> 
<RelativeLayout ...> 
    <viewpager></viewpager> 
    <com.example.ExpandableHeightListView ... /> 
    <other view items /> 
</RelativeLayout> 
ようscrollviewにExpandableHeightlistviewを使用そして、リストビュー の最後にとsetadpater 0

非常に重要listview.setExpandable(真)

あなたの代わりrecyclerviewのリストビューを使用する理由
関連する問題