I have a ListView (will move to RecyclerView) with a ListView Item XML layout that contains 3 TextViews inside a LinearLayout. My user preferences allow for left-handed or right-handed use. In which case, I want to change the order of the TextViews in the Item Layout file.
What is the preferred Design Pattern here? How do I do that?
Just looking to learn and do it the right way.
The duplicate post mentioned by Sandi did what I wanted very easily, and without any duplication of XML files or code to rearrange order. Thanks to everyone that responded and got me here. I just wanted to make sure that I posted what easily worked for me.
I have a TAB with two different ListViews each with their own ListItem XML layouts, and this reversed the order perfectly in the onCreateView for the TabFragment.java in the main Layout and in each of the ListItem layouts!
// Inflate this Tab's checklist XML
root = inflater.inflate(R.layout.tab_fragment, container, false);
if (leftHanded) {
LinearLayout linearLayout = root.findViewById(R.id.tabLinearLayout);
linearLayout.setLayoutDirection(LinearLayout.LAYOUT_DIRECTION_RTL);
}