Tabhost related Error

Source: Internet
Author: User

1.Your content must has a tabhost whose id attribute is ' Android. R.id.tabhost ' resolution


Android:id= "@android: Id/tabhost"

Attention is @android:id, not usually written @id
2.Attempt to invoke virtual method ' Boolean android.view.View.requestFocus () ' On a null object reference

<tabwidget    android:id= "@android: Id/tabs"    android:layout_width= "match_parent"    android:layout_ height= "Wrap_content" >


No write at the end
/

Tabhost contains two controls: Tabwidget and Framelayout are parallel independent relationships, not included, because they are beginner, so not clear.

<span style= "Font-family:times New roman;font-size:14px;" ><tabhost xmlns:android= "http://schemas.android.com/apk/res/android" android:layout_width= "Fill_parent" android:layout_height= "Fill_parent" android:id= "@android: Id/tabhost" > <linearlayout android:orientation= " Vertical "android:layout_width=" fill_parent "android:layout_height=" fill_parent "> <span style=" Background-color:rgb (51, 204, 255); " > <tabwidget android:id= "@android: Id/tabs" android:layout_width= "Match_parent" Android oid:layout_height= "Wrap_content"/></span> <span style= "Background-color:rgb (51, 204, 0);" > <FrameLayout</span> android:layout_width= "match_parent" android:layout_height=                "Match_parent" android:id= "@android: Id/tabcontent" > <!--define the contents of the first tab-- <linearlayout android:id= "@+id/tab01" android:orientation= "vertical" android:layout_wiDth= "Fill_parent" android:layout_height= "Fill_parent" > <!--define two TextView to display the contents of the tab page-- <textview android:layout_width= "fill_parent" android:layout_height= "wrap_content" android:text= "Monkey King-2011/0 7/12 "/> <textview android:layout_width=" fill_parent "android:layout_height=" Wrap_content "Android                : text= "Pig -2011/07/10"/> </LinearLayout> <!--define the contents of the second tab-- <linearlayout android:id= "@+id/tab02" android:orientation= "vertical" android:layout_width= "Fill_parent" Android : layout_height= "Fill_parent" > <textview android:layout_width= "fill_parent" android:layout_height= "Wrap_content" android:text= "sa monk -2011/07/11"/> <textview android:layout_width= "Fill_parent" Androi d:layout_height= "Wrap_content" android:text= "Tang priest -2011/07/10"/> </LinearLayout> <!           --Define the contents of the Third tab--     <linearlayout android:id= "@+id/tab03" android:orientation= "vertical" android:layout_width= "Fill_parent" Android : layout_height= "Fill_parent" > <textview android:layout_width= "fill_parent" android:layout_height= "Wrap_content" android:text= "Monkey King -2011/07/12"/> <textview android:layout_width= "Fill_parent" Andro id:layout_height= "wrap_content" android:text= "sa monk -2011/07/08"/> </LinearLayout> <span Style= "Background-color:rgb (51, 204, 0); > </FrameLayout></span> </LinearLayout></span>



Tabhost related Error

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.