0

我現在在viewpager之前使用viewpager還有一個tablayout和videoview以及我的viewpager片段內容很大,那麼它必須顯示內滾動視圖,所以我如何顯示viewpagers片段視圖在可滾動區域?一旦我以滾動視圖作爲內部片段視圖的父佈局,然後viewpager不顯示任何片段?如何解決這個問題?我必須讓我的viewpagers片段作爲滾動如何使ViewPage的片段部分在android中可滾動?

<?xml version="1.0" encoding="utf-8"?> 
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 
    <RelativeLayout 
     android:id="@+id/rlayout_detailvideo" 
     android:layout_width="match_parent" 
     android:layout_height="300dp" 
     android:visibility="visible"> 

    <com.app.VideoViewCustom android:id="@+id/videoplayer" 
     android:layout_width="match_parent" 
     android:layout_height="300dp" 
     /> 
     <ImageView 
      android:id="@+id/imageview_videodetailbackarrow" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:src="@drawable/video_detail_back_btn" 
      android:padding="15dp" 
      android:layout_alignParentLeft="true" 
      android:layout_marginLeft="@dimen/videodetail_backarrow_marginleft" 
      android:layout_marginTop="@dimen/videodetail_backarrow_margintop"/> 
     <ImageView 
      android:id="@+id/imageview_edit" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:src="@drawable/video_detail_edit_btn" 
      android:padding="15dp" 
      android:layout_alignParentRight="true" 
      android:layout_marginRight="@dimen/videodetail_edit_marginright" 
      android:layout_marginTop="@dimen/videodetail_backarrow_margintop"/> 
     <ImageView 
      android:id="@+id/imageview_bottom" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:src="@drawable/video_detail_fullscreen_btn" 
      android:padding="15dp" 
      android:layout_alignParentBottom="true" 
      android:layout_alignParentRight="true" 
      android:layout_marginRight="@dimen/videodetail_edit_marginright" 
      android:layout_marginTop="@dimen/videodetail_backarrow_margintop"/> 

    </RelativeLayout> 
    <android.support.design.widget.TabLayout 
     android:id="@+id/videodetail_tabs" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     app:tabGravity="fill" 
     app:tabIndicatorColor="@color/actionbar_backgroundcolor" 
     app:tabIndicatorHeight="3dp" 
     android:layout_below="@+id/rlayout_detailvideo" 
     android:background="#ffffff" 
     /> 
    <!--style="@style/MyCustomTabLayout"--> 

    <View 
     android:id="@+id/view_videodetail" 
     android:layout_height="1dp" 
     android:layout_width="match_parent" 
     android:background="@android:color/darker_gray" 
     android:layout_below="@+id/videodetail_tabs" 
     /> 
    <android.support.v4.view.ViewPager 
     android:id="@+id/videodetail_pager" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior" 
     android:layout_below="@+id/view_videodetail" 
     android:layout_marginTop="@dimen/infotab_layout_margintop" 
     /> 
</RelativeLayout> 

我怎樣才能讓viewpagers片段佈局滾動?

+0

可能的重複[如何確定何時在ViewPager中可見碎片](http://stackoverflow.com/questions/10024739/how-to-determine-when-fragment-becomes-visible-in-viewpager) – Gattsu

+0

@ maveň試着首先了解這個問題 – Erum

回答

0

首先,我們可以採用滾動視圖,然後單個子線形佈局。使用此線性佈局創建您的設計。

<FrameLayout 
     android:id="@+id/product_center_diamond_fragments" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_marginBottom="@dimen/margin_5" 
     > 



     <ScrollView 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:overScrollMode="never"> 

      <LinearLayout 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:orientation="vertical" 
       > 
       ..................... 
       Design your UI 

................................

像那個。

+0

我已經在碎片UI中使用了recyclerview,所以現在使用scrolview + linearlayou我的recyclerview不顯示 – Erum