Android - My own tab control
I don't like the way the tabs look with the native tab control in Android so I'd like to create my own control. I can create and draw my own tabs in a horizontal LinearLayout at the top of the sc开发者_如何学运维reen using a vertical LL, but how do I setup the various hidden tab contents in the XML and how do I show/hide them?
Any potential issues?
I would recommend using the source code for the existing tab control as a starting place to build your new widget. If you're truly just changing the look and feel, this is a much less error-prone option.
I used FrameLayout and its just a matter of setting the visibility. I'm not sure why this took so long to figure out, I must have been searching wrong online.
tab1.setVisibility(View.INVISIBLE);
tab2.setVisibility(View.VISIBLE);
精彩评论