When a new item is added, it's populated from the bottom of the UI, so I tried some methods from LinearLayoutManager setReverseLayout() == true but items stack from bottom. I tried different combinations of reverseLayout and stackFromEnd, but still no luck, the new item is still populated from the bottom of the UI, second item is populated below the first item, and all the way stack to the top.
What I want is that the first item will be populated on the top of the UI, not bottom, and then the second will be below the first item etc..
val recyclerView = findViewById<RecyclerView>(R.id.recyclerview)
val adapter = SomeListAdapter(Some params)
val llManager = LinearLayoutManager(this)
llManager.reverseLayout = true
llManager.stackFromEnd = true
recyclerView.adapter = adapter
recyclerView.layoutManager =llManager
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/layout"
tools:context=".AddressActivity">
<RelativeLayout
android:id="@+id/rl_address"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="60dp"
android:background="@color/black"
android:backgroundTint="#FEFBDE"
android:orientation="vertical"
android:padding="5dp">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:listitem="@layout/address_item"
android:layout_above="@+id/ll_addAddress"
/>
<RelativeLayout
android:id="@+id/ll_addAddress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginTop="1dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/addNewAddress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Add New Address">
</Button>
<Button
android:id="@+id/viewAllAddress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="View all addresses">
</Button>
<Button
android:id="@+id/welcome_landlord"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Welcome Landlord" />
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/navigation_menu"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_alignParentBottom="true"
app:labelVisibilityMode="labeled"
app:menu="@menu/bottom_navigation_menu">
</com.google.android.material.bottomnavigation.BottomNavigationView>
</RelativeLayout>