Я использую ScrollView в макете фрагмента, но прокрутка происходит намного медленнее, чем в большинстве других приложений, и она вообще не скользит.
<?xml version = "1.0" encoding = "utf-8"?>
<RelativeLayout xmlns:android = "http://schemas.android.com/apk/res/android"
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:orientation = "vertical">
<include layout = "@layout/toolbar" />
<ScrollView
xmlns:android = "http://schemas.android.com/apk/res/android"
android:layout_width = "match_parent"
android:layout_height = "match_parent">
<include layout = "@layout/content" />
</ScrollView>
</RelativeLayout>
И @layout/content:
<?xml version = "1.0" encoding = "utf-8"?>
<RelativeLayout xmlns:android = "http://schemas.android.com/apk/res/android"
android:layout_width = "match_parent"
android:layout_height = "match_parent">
<LinearLayout
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:orientation = "vertical">
<android.support.v7.widget.RecyclerView
android:id = "@+id/recycler_view"
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:clipToPadding = "false"
android:scrollbars = "vertical" />
<LinearLayout
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:layout_gravity = "center_horizontal">
<android.support.v7.widget.CardView
xmlns:android = "http://schemas.android.com/apk/res/android"
xmlns:cardview = "http://schemas.android.com/apk/res-auto"
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:layout_margin = "8dp"
android:foreground = "?android:attr/selectableItemBackground"
cardview:cardCornerRadius = "8dp"
android:clickable = "true"
android:focusable = "true">
<LinearLayout
android:layout_width = "fill_parent"
android:layout_height = "wrap_content"
android:orientation = "horizontal"
android:padding = "6dp">
<ImageView
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:src = "@drawable/ic_arrow_forward_24dp" />
<LinearLayout
android:layout_width = "fill_parent"
android:layout_height = "wrap_content"
android:layout_marginStart = "4dp"
android:layout_weight = "0.9"
android:orientation = "vertical"
android:padding = "4dp">
<TextView
android:id = "@+id/view_more"
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:text = "View more" />
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
</LinearLayout>
Я добавил макет контента
Я бы посоветовал вам использовать NestedScrollView в вашем случае, поскольку у вас есть RecyclerView внутри вашего ScrollView. Измените родительский макет следующим образом.
<?xml version = "1.0" encoding = "utf-8"?>
<RelativeLayout xmlns:android = "http://schemas.android.com/apk/res/android"
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:orientation = "vertical">
<include layout = "@layout/toolbar" />
<NestedScrollView
xmlns:android = "http://schemas.android.com/apk/res/android"
android:layout_width = "match_parent"
android:layout_height = "match_parent">
<include layout = "@layout/content" />
</NestedScrollView>
</RelativeLayout>
у него есть v7 API, поменять его на NestedScrollView
Поделитесь пожалуйста своим макетом
content.