In my activity, I have a custom color set for statusBar and navigationbar using
<item name="android:statusBarColor" tools:targetApi="l">?attr/mainUIColor</item>
<item name="android:navigationBarColor" tools:targetApi="l">?attr/mainUIColor</item>
In this activity, I have a RecyclerView. And I want it to scroll to the bottom when the user opens the soft keyboard. The following snippet does that job,
View rootView = findViewById(R.id.chat_root_view).getRootView();
ViewCompat.setOnApplyWindowInsetsListener(rootView, (v, insets) -> {
recyclerView.scrollToPosition(chatAdapter.getItemCount() - 1);
return insets;
});
But when this function is called, It’s also resetting the statusBar and navigationbar color which I set in my themes.xml. How can I scroll the recyclerView without changing the systemBar colors?