I am using a Tab layout to display 3 different Content Views however there are several Views (Buttons to be precise) which are common to across all 3 Content Views. Currently I have uniquely identified all the common views e.g.
android:id=@+id/tab1_button1
even though they carry out the same function despite which Tab Content is currently displayed.
Is there a way I can maintain the same View id across all the Tab Contents? Is it a matter of just identifying the Views with the same id?
Because I’m Using Tabs I understand that TabHost must be the root node of a Layout therefore I cannot have TabHost within another Layout. Do I understand this correctly?
You can use the same id across the tabs
android:id=@+id/tab_button1forbutton1on all the tabs. However it isn’t a good design, you’d better extract the similar parts of your layout as include to avoid code duplication. More info here.