I'm going to implement such a title bar
A total of 4 options, using the layout is a TextView corresponding to a small triangular ImageView, each option is not clicked, the font color is black, the small triangle does not display, click, the font color, the small triangle under the display, while the following layout display the corresponding content.
It is not difficult to implement such logic, but if you write it regularly, the code snippet is long and tedious! I did it later.
Write a generic function that gets list<> to get the layout collection to display
Write a Map generic function that gets TextView and ImageView corresponding bindings
The end is integration, collective change
This invokes
Then we have configured an option, a total of four options, corresponding to four click events, that is, write four times, you only need to change, the incoming integer, the other do not, 0,1,2,3 ...
That's all. The program works perfectly,
How Android correctly uses generics and multi-parameter "lazy"