2015-12-28 40 views
2

下面是我的代碼,但它不能正常工作,希望在所有片段的scrollview viewpager。滾動的滾動視圖不工作,面臨的問題,從過去2小時,並沒有得到一個解決方案。請幫助我它的迫切。無法解決這個問題,我試圖添加嵌套的滾動視圖,但它也無法正常工作。ScrollView裏面viewpager滾動垂直不工作

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical"> 

<LinearLayout 
    android:id="@+id/toolbar_ll" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"> 

    <android.support.v7.widget.Toolbar 
     android:id="@+id/toolbar_myjeenees" 
     android:layout_width="match_parent" 
     android:layout_height="56dp" 
     android:background="@android:color/white" 
     android:minHeight="?attr/actionBarSize"> 

     <TextView 
      android:id="@+id/toolbarShuffle" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center" 
      android:text="Shuffle Money" 
      android:textColor="@color/black" 
      android:textSize="18sp" /> 

    </android.support.v7.widget.Toolbar> 
</LinearLayout> 

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

    <LinearLayout 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     android:orientation="vertical"> 

     <TextView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:padding="5dp" 
      android:text="UserName" 
      android:textSize="25sp" /> 

     <TextView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:padding="5dp" 
      android:text="May 15,Birthday" /> 

    </LinearLayout> 

    <ImageView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="center" 
     android:layout_marginRight="10dp" 
     android:background="@mipmap/ic_forward" /> 
</LinearLayout> 


<com.android.jeenees.utils.CustomScrollView 
    android:id="@+id/scrollView" 
    android:layout_width="match_parent" 
    android:layout_height="0dp" 
    android:layout_weight="1" 
    android:fillViewport="true" 
    > 

    <android.support.v4.view.ViewPager 
     android:id="@+id/shufflePager" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:background="@android:color/white" /> 
</com.android.jeenees.utils.CustomScrollView> 
<!--</LinearLayout>--> 

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

    <ImageButton 
     android:layout_width="0dp" 
     android:layout_height="match_parent" 
     android:layout_weight="1" 
     android:background="@color/colorPrimary" 
     android:padding="10dp" 
     android:src="@mipmap/ic_action_tick" /> 

    <ImageButton 
     android:layout_width="0dp" 
     android:layout_height="match_parent" 
     android:layout_weight="1" 
     android:background="@color/colorPrimary" 
     android:padding="10dp" 
     android:src="@mipmap/ic_back" /> 
</LinearLayout> 

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:fillViewport="true" 
android:orientation="vertical"> 

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="0dp" 
    android:layout_margin="10dp" 
    android:layout_weight="1" 
    android:orientation="vertical"> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_weight="1" 
     android:fillViewport="true"> 

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

      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="0dp" 
       android:layout_weight="1" 
       android:orientation="vertical"> 

       <LinearLayout 
        android:layout_width="match_parent" 
        android:layout_height="0dp" 
        android:layout_weight="1" 
        android:gravity="center" 
        android:orientation="horizontal"> 

        <TextView 
         android:id="@+id/firstwish" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:text="IPhone 5s" /> 

        <View 
         android:layout_width="0dp" 
         android:layout_height="wrap_content" 
         android:layout_weight="1" /> 

        <TextView 
         android:id="@+id/costfirst" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:text="Rs 5300/32777" /> 
       </LinearLayout> 

       <LinearLayout 
        android:layout_width="match_parent" 
        android:layout_height="0dp" 
        android:layout_weight="1" 
        android:gravity="center" 
        android:orientation="vertical"> 

        <SeekBar 
         android:id="@+id/seekfirst" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:max="100" 
         android:maxHeight="10dp" 
         android:progress="50" 
         android:progressDrawable="@drawable/progress_draw" 
         android:splitTrack="false" 
         android:thumb="@mipmap/ic_thumb"></SeekBar> 
       </LinearLayout> 
      </LinearLayout> 

      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="0dp" 
       android:layout_weight="1" 
       android:orientation="vertical"> 

       <LinearLayout 
        android:layout_width="match_parent" 
        android:layout_height="0dp" 
        android:layout_weight="1" 
        android:gravity="center" 
        android:orientation="horizontal"> 

        <TextView 
         android:id="@+id/secondwish" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:text="IPhone 5s" /> 

        <View 
         android:layout_width="0dp" 
         android:layout_height="wrap_content" 
         android:layout_weight="1" /> 

        <TextView 
         android:id="@+id/costsecond" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:text="Rs 5300/32777" /> 
       </LinearLayout> 

       <LinearLayout 
        android:layout_width="match_parent" 
        android:layout_height="0dp" 
        android:layout_weight="1" 
        android:gravity="center" 
        android:orientation="vertical"> 

        <SeekBar 
         android:id="@+id/seeksecond" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:max="100" 
         android:maxHeight="10dp" 
         android:progress="50" 
         android:progressDrawable="@drawable/progress_draw" 
         android:splitTrack="false" 
         android:thumb="@mipmap/ic_thumb"></SeekBar> 
       </LinearLayout> 
      </LinearLayout> 

      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="0dp" 
       android:layout_weight="1" 
       android:orientation="vertical"> 

       <LinearLayout 
        android:layout_width="match_parent" 
        android:layout_height="0dp" 
        android:layout_weight="1" 
        android:gravity="center" 
        android:orientation="horizontal"> 

        <TextView 
         android:id="@+id/thirdwish" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:text="IPhone 5s" /> 

        <View 
         android:layout_width="0dp" 
         android:layout_height="wrap_content" 
         android:layout_weight="1" /> 

        <TextView 
         android:id="@+id/costthird" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:text="Rs 5300/32777" /> 
       </LinearLayout> 

       <LinearLayout 
        android:layout_width="match_parent" 
        android:layout_height="0dp" 
        android:layout_weight="1" 
        android:gravity="center" 
        android:orientation="vertical"> 

        <SeekBar 
         android:id="@+id/seekthird" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:max="100" 
         android:maxHeight="10dp" 
         android:progress="50" 
         android:progressDrawable="@drawable/progress_draw_red" 
         android:splitTrack="false" 
         android:thumb="@mipmap/ic_red_thumb"></SeekBar> 
       </LinearLayout> 
      </LinearLayout> 
     </LinearLayout> 
    </LinearLayout> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_weight="0.5" 
     android:gravity="center" 
     android:orientation="vertical"> 

     <TextView 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:gravity="center" 
      android:padding="10dp" 
      android:text="Rs 1700" 
      android:textSize="25sp" /> 


     <TextView 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:gravity="center" 
      android:padding="10dp" 
      android:text="Released Money" 
      android:textSize="25sp" /> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:gravity="center" 
      android:orientation="horizontal"> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:background="@color/colorPrimary" 
       android:drawableLeft="@mipmap/ic_actin_add" 
       android:gravity="center" 
       android:padding="15dp" 
       android:text="Top Up" 
       android:textColor="@android:color/white" /> 
     </LinearLayout> 
    </LinearLayout> 
</LinearLayout> 

+0

當你在'Fragment'佈局中已經有'ScrollView'時,爲什麼在'ScrollView'中添加'ViewPager'? – Rehan

+0

那一個我糾正:)但仍然滾動不起作用:) – user3475052

+0

我做父窗口作爲滾動視圖,但它仍然不工作 – user3475052

回答

1

每個視圖取父事件首先,如果你的觀點傳呼機刷卡horizo​​natly變革比你不能在孩子片段使用horizo​​natl滾動頁面標籤。這不是寫作練習,您可以將頁面內容排列爲垂直並使用垂​​直滾動視圖。 或者第二個選項,您將不得不禁用查看尋呼機的滑動事件,並且只有選項卡單擊才能更改頁面,而不是使用水平滾動視圖。