Hello,
Welcome to our Microsoft Q&A platform!
but the RecyclerView is cropped (rather than resized), therefore making it not scrollable. I tried setting the RecyclerView's layout_height to a fixed value, but it was still not scrollable
I add more items to the recyclerView and reproduce the problem. This is because the recyclerView's height is larger than the include layout has. To fix this issue, try using PercentRelativeLayout
instead. We need to install the Xamarin.AndroidX.PercentLayout package to use the layout.
Here is the sample code, you could refer to it.
<androidx.percentlayout.widget.PercentRelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textView1"
android:text="the first column"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView1"
android:layout_below="@id/textView1"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_heightPercent="85%"
app:layout_widthPercent="100%"/>
<Button
android:id="@+id/btn"
android:layout_below="@id/recyclerView1"
android:text="button"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</androidx.percentlayout.widget.PercentRelativeLayout>
Best Regards,
Jarvan Zhang
If the response is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.