Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
209 views
in Technique[技术] by (71.8m points)

Add a scrollable imageview and recyclerview in one layout?

I want to use in imageview above a recyclerview in home feed to show some pin some specific images. And when the user start scrolling the image get scrolled and he can continue scrolling in the recyclerview. I use the below code to implement but the recyclerview scrolling become very very slow is there any way to solve that?

<?xml version="1.0" encoding="utf-8"?>                                                 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
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"
tools:context=".Fragments.HomeFragment">

<androidx.core.widget.NestedScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">
    <androidx.cardview.widget.CardView
        android:layout_width="match_parent"
        app:cardCornerRadius="4dp"
        android:layout_height="wrap_content">
        <ImageView
            android:id="@+id/pin_img"
            android:layout_width="match_parent"
            android:layout_height="300dp"
            android:visibility="gone" />
    </androidx.cardview.widget.CardView>
<androidx.recyclerview.widget.RecyclerView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/recycler_view_home">
</androidx.recyclerview.widget.RecyclerView>
        <ProgressBar
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:visibility="gone"
            android:layout_gravity="center"
            android:id="@+id/progress_bar"/>

    </LinearLayout>
</androidx.core.widget.NestedScrollView>             </RelativeLayout>
question from:https://stackoverflow.com/questions/65838249/add-a-scrollable-imageview-and-recyclerview-in-one-layout

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...