Android: tabwidget/tabhost

Source: Internet
Author: User

I:Use the built-in tabhost (and inherit from the tabactivity class)

Tabhost =This. Gettabhost ();

Tabhost. addtab (tabhost. newtabspec ("tab1 ")
. Setindicator ("list") // set the display tab name
. Setcontent (new intent (this, list1.class); // sets the redirected activity.

 

See: http://wangjun.easymorse.com /? P = 155

 

II:Define our own tabhost: do not inherit tabactivity

CustomizeThe XML layout of tabhost. Note thatThe ID of tabwidget in the layout file must be defined as: Android: Id = "@ Android: ID/tabs", and the ID of framelayout must be defined as: Android: Id = "@ Android: ID/tabcontent "other controls are not restricted; otherwise, an error is returned.

Tabhost = (tabhost)This. Findviewbyid (R. Id. tabhost01 );

 

See http://fatkun.com/2010/06/android-tabwidget.html

 

Two methodsCodeSpecific can also refer to the http://aina-hk55hk.iteye.com/blog/686249

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.