Hello,
Welcome to our Microsoft Q&A platform!
It seems there is nothing wrong with the code that adding the new values for the recyclerView. The problem may be related to the rendering view. If you want to set adaptive width the recyclerView, you could just set the width of the recyclerView to wrap_content
. Then it will adjust it's width automatically when adding new items..
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/test_recyclerView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
Best Regards,
Jarvan Zhang
If the response is helpful, please click "Accept Answer" and upvote it.
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.