1

As my codes below, I tried to overlap the Recyclerview over ScrollView. I saw few tutorials that used by java but I wanted to create in xml codes. I'm not sure if I'm doing it right. Attachment is what I wanted to create, pls take it as your reference.

enter image description here

<?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" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:background="#759AF8">

    <LinearLayout 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:orientation="vertical" 
        android:layout_marginTop="50dp">
        
        <TextView 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Trend" 
            android:textStyle="bold" 
            android:textSize="24sp"
            android:layout_gravity="center" />
        
        <TextView 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="What's trending in Korea"
            android:textSize="18sp"
            android:layout_gravity="center" />
      </LinearLayout>

      <ScrollView 
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:background="@drawable/recipe_background"
          android:layout_marginTop="200dp"
          android:padding="20dp">

          <androidx.recyclerview.widget.RecyclerView
              android:id="@+id/recycler"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_gravity="center_horizontal"
              android:elevation="7dp"
              app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
              android:orientation="vertical" />
      </ScrollView>

</RelativeLayout>
UkFLSUI
  • 5,509
  • 6
  • 32
  • 47
Sue .K
  • 11
  • 1
  • Is that round-cornered bg is static? or it moves ? – AgentP Jul 13 '20 at 05:59
  • 1
    why do you want to keep `RecyclerView` inside `ScrollView`? `RecyclerView` can scroll itself, creating one scrollable container inside anothger scrollable container may lead to some issues with touch dispatching – snachmsm Jul 13 '20 at 06:02
  • That round cornered background is static which is made in drawable – Sue .K Jul 13 '20 at 06:24

0 Answers0