0

Bir android acemi burada :-) Malzeme tasarımında CoordinatorLanyout okuyorum. Bu yüzden TabLayout'u KoordinatorLanyout içinde uygulamaya çalıştım ve iyi çalıştı. Ama ben ViewPager için bir parçası içinde RecyclerView uyguladı ve garip bir kaydırma sorunu ile karşı karşıya. Liste şimdi kaydırma yapmıyor. Burada çok fazla çözüm denedim ve denedim ama hiçbir şey bu sorunu çözemez. burdayım benim burada activity_main.xmViewPager gösteriliyor Kaydırma sorunu İçinde KoordinatorLayout

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
xmlns:local="http://schemas.android.com/tools" 
android:id="@+id/main_content" 
android:layout_width="match_parent" 
android:layout_height="match_parent"> 

<android.support.design.widget.AppBarLayout 
    android:id="@+id/appbar" 
    android:layout_width="match_parent" 
    android:layout_height="@dimen/detail_backdrop_height" 
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
    android:fitsSystemWindows="true"> 

    <android.support.design.widget.CollapsingToolbarLayout 
     android:id="@+id/collapsing_toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     app:layout_scrollFlags="scroll|exitUntilCollapsed" 
     android:fitsSystemWindows="true" 
     android:elevation="8dp" 
     app:contentScrim="?attr/colorPrimary" 
     app:expandedTitleMarginStart="20dp" 
     app:expandedTitleMarginEnd="10dp"> 

     <include 
      android:id="@+id/counter_id" 
      layout="@layout/counter_layout"/> 

     <android.support.v7.widget.Toolbar 
      android:id="@+id/toolbar" 
      android:elevation="8dp" 
      android:layout_height="?attr/actionBarSize" 
      android:layout_width="match_parent" 
      app:layout_collapseMode="pin"/> 


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

<android.support.design.widget.TabLayout 
      android:id="@+id/pager_tab_id" 
      android:background="@color/colorPrimary" 
      android:layout_height="?attr/actionBarSize" 
      android:layout_width="match_parent" 
      android:layout_gravity="bottom" 
      app:tabMode="scrollable"/> 

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

<android.support.v4.widget.NestedScrollView 
    android:layout_width="match_parent" 
    android:fillViewport="true" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    android:layout_height="match_parent"> 

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

     <FrameLayout 
      android:layout_width="match_parent" 
      android:id="@+id/container_body" 
      android:layout_height="match_parent"> 
     </FrameLayout> 
    </LinearLayout> 

</android.support.v4.widget.NestedScrollView> 

parçaları değiştirilmesi için çerçeve düzenidir. böylece görüntüleyici bu çerçeve kabını alacaktır.

Am i yanındaki i RecyclerView adaptörü için bir xml

<RelativeLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
android:id="@+id/swipe_container_service" 
android:layout_width="match_parent" 
android:fitsSystemWindows="true" 
android:layout_height="match_parent"> 


<SearchView 
    android:id="@+id/search" 
    android:visibility="gone" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_gravity="center_vertical" 
    android:paddingLeft="20dp" 
    android:paddingRight="20dp" 
    android:textSize="16sp" 
    android:hint="Search here"/> 
<android.support.v7.widget.RecyclerView 
    android:id="@+id/recycler_list" 
    android:layout_below="@+id/search" 
    android:layout_width="match_parent" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    android:layout_height="match_parent" 
    android:clipToPadding="false" 
    android:fillViewport="true" 
    android:layout_marginTop="4dp" 
    /> 
</RelativeLayout> 

tasarlanmış

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:local="http://schemas.android.com/apk/res-auto" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
android:orientation="vertical" 
tools:context="bodhi.electionpoll.ui.fragment.PanchayathHistoryFragment"> 

<android.support.v4.view.ViewPager 
    android:id="@+id/content_panchayath_hisory_pager" 
    android:background="@color/windowBackground" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"/> 

</RelativeLayout> 

yukarıda belirtilen activity_main.xml içinde FrameLayout kullanacak viewPager düzenini ayarlamak için bu xml kullanarak i bunların uygulanmasından sonra ilgili java dosyalarını

belirtmeye gerek olmadığını düşünün, kaydırma çalışmıyor

cevap

1

Kişisel yapısı böyle olmalı ->

<CoordinatorLayout> 
     <AppBarLayout> 
      <CollapsingToolbarLayout> 
       <Layout/> 
       <Toolbar/> 
      </CollapsingToolbarLayout> 
      <TabLayout/> 
     </AppBarLayout> 
    <ViewPager/> 
    </CoordinatorLayout> 

i anlayacaksınız düşünüyorum.

+0

evet denedim ama sorun hala devam ediyor. –

+0

Şimdi bu kadar becz sanmıyorum sekmelerim görünmez –

+0

ViewBarLayout ve CoordinatorLayout sonu arasında görünümünüzü koymak. İyi çalışmalı. Ayrıca NestedScrollView'ı da kaldırın. –