0

私はAndroid開発には初めてです。私はリストを表示するためにリサイクルビューを使用しています。私はそれがスクロールのデフォルトの動作を持っていると仮定しますが、それは起こっていません。誰も私にいくつかの提案を与えることができます。以下は私が使っているレイアウトです。Android Recyclerviewスクロールの問題

<?xml version="1.0" encoding="utf-8"?> 
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fitsSystemWindows="true" 
    android:background="@android:color/transparent" 
    tools:context="com.team.sidhesh.MainActivity"> 

    <android.support.design.widget.AppBarLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:background="@drawable/background" 
     android:theme="@style/AppTheme.AppBarOverlay"> 

     <android.support.v7.widget.Toolbar 
      android:id="@+id/toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="?attr/actionBarSize" 
      app:popupTheme="@style/AppTheme.PopupOverlay" /> 

     <ImageView 
      android:id="@+id/sliderTempImageView" 
      android:layout_width="match_parent" 
      android:layout_height="@dimen/slider_image_height" 
      android:src="@drawable/homescreen_logo" 
      android:scaleType="fitCenter" 
      android:background="@android:color/transparent"/> 

     <android.support.v7.widget.RecyclerView 
      android:id="@+id/recycler_view" 
      android:background="@android:color/transparent" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:scrollbars="vertical" 
      android:paddingBottom="10dp"/> 

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

</android.support.design.widget.CoordinatorLayout> 
+0

いずれかにrecyclerViewをラップでいつかこれが原因あなたのImageViewの中で使用しているドロウアブルに起こります。ドロウアブルはあまり大きくないようにしてください。 –

答えて

0

はこれを試してみてください。

また
<?xml version="1.0" encoding="utf-8"?> 
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fitsSystemWindows="true" 
    android:background="@android:color/transparent" 
    tools:context="com.team.sidhesh.MainActivity"> 

    <android.support.design.widget.AppBarLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:background="@drawable/background" 
     android:theme="@style/AppTheme.AppBarOverlay"> 

     <android.support.v7.widget.Toolbar 
      android:id="@+id/toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="?attr/actionBarSize" 
      app:popupTheme="@style/AppTheme.PopupOverlay" /> 

     <ImageView 
      android:id="@+id/sliderTempImageView" 
      android:layout_width="match_parent" 
      android:layout_height="@dimen/slider_image_height" 
      android:src="@drawable/homescreen_logo" 
      android:scaleType="fitCenter" 
      android:background="@android:color/transparent"/> 

     <android.support.v4.widget.NestedScrollView 
      android:layout_width="match_parent" 
      android:layout_height="470dp" 
      android:layout_weight="1" 
      android:background="@android:color/darker_gray" 
      app:layout_behavior="@string/appbar_scrolling_view_behavior"> 
     <android.support.v7.widget.RecyclerView 
      android:id="@+id/recycler_view" 
      android:background="@android:color/transparent" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:scrollbars="vertical" 
      android:paddingBottom="10dp"/> 
     </android.support.v4.widget.NestedScrollView> 
    </android.support.design.widget.AppBarLayout> 

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

あなたのGradleファイルに依存関係を追加してください

compile 'com.android.support:recyclerview-v7:22.2.0' 
0

なぜあなたはAppBarLayoutRecyclerViewを使用していますか? CoordinatorLayoutの下で、AppBarLayoutの外にあるべきではありませんか?あなたが期待するものを達成するために

、このリンクをチェックしてください:https://developer.android.com/reference/android/support/design/widget/AppBarLayout.html

示して/言う:<!-- Your scrolling content -->

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

     <!-- Your scrolling content --> 

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

ですから、AppBarLayoutRecyclerView外に配置し、追加する必要があります:アプリ: layout_behavior = "@文字列/ appbar_scrolling_view_behavior"をRecyclerViewに追加します。私はAppBarLayoutlayout_heightwrap_contentのいずれかを設定しました。

<?xml version="1.0" encoding="utf-8"?> 
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@android:color/transparent" 
    android:fitsSystemWindows="true" 
    tools:context="com.team.sidhesh.MainActivity"> 

    <android.support.design.widget.AppBarLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:background="@drawable/background" 
     android:theme="@style/AppTheme.AppBarOverlay"> 

     <android.support.v7.widget.Toolbar 
      android:id="@+id/toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="?attr/actionBarSize" 
      app:popupTheme="@style/AppTheme.PopupOverlay" /> 

     <ImageView 
      android:id="@+id/sliderTempImageView" 
      android:layout_width="match_parent" 
      android:layout_height="@dimen/slider_image_height" 
      android:background="@android:color/transparent" 
      android:scaleType="fitCenter" 
      android:src="@drawable/homescreen_logo" /> 

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

    <android.support.v7.widget.RecyclerView 
     android:id="@+id/recycler_view" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:background="@android:color/transparent" 
     android:paddingBottom="10dp" 
     android:scrollbars="vertical" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior" /> 

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

そして、それは何ですか。ImageViewはすべてについてですか?スライダーを使用するには?それでは、おそらくCollapsingToolbarLayoutといっしょにまとめておく必要があります。あなたは何をすべき

関連する問題