Android Recyclerview滚动问题
我是Android开发新手。我正在使用recycler视图显示列表。我假设它有滚动的默认行为,但它没有发生。谁能给我一些建议吗。下面是我正在使用的布局Android Recyclerview滚动问题,android,android-recyclerview,android-coordinatorlayout,Android,Android Recyclerview,Android Coordinatorlayout,我是Android开发新手。我正在使用recycler视图显示列表。我假设它有滚动的默认行为,但它没有发生。谁能给我一些建议吗。下面是我正在使用的布局 <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="htt
<?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>
试试这个:
<?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>
为什么要在
AppBarLayout
中使用RecyclerView
?它不应该在协调布局下
和AppBarLayout
之外吗
要实现您的期望,请检查此链接:
显示/显示:
那
ImageView
是关于什么的?用于使用滑块?那么,也许你也需要用一个 您应该做的是将recyclerView包装成或有时,由于您在imageview中使用的可提取项,会出现这种情况。drawables应该不会太大。您可以为添加的链接添加更多信息吗?
compile 'com.android.support:recyclerview-v7:22.2.0'
<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>
<?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>