I have checked the Navigation drawer: How do I set the selected item at startup? post. In that post the navigation drawer has a menuview, and my navigation drawer has a listview.
I have a navigation drawer, and a list init. I have setup my list whenever an item chosen, the item gets in a pressed state and highlights the chosen list item. This function works well and looks as following.
activityBinding.list.setOnItemClickListener((parent, view, position, id) -> {
parent.getChildAt(position).setPressed(true);
});
I have an xml, which is set on the listviev textcolor attribute. The xml looks like that:
<item android:state_pressed="true"
android:color="#ffffffff"/>
<item android:state_focused="true"
android:color="#ff0000ff"/>
<item android:color="#00000000"/>
However I would like to setup the first item of the list pressed as default, before opening the drawer. My question is: How to get to an item of a list an set it to pressed outside of the setOnItemListener?