Issue with displaying TabHost Layout in new Intent

后端 未结 9 2043
悲哀的现实
悲哀的现实 2021-01-20 21:05

I am having an issue with using TabHost in a new Intent of type TabActivity which I hope you can point me in the right direction. Funnily it works fine when I try to view it

相关标签:
9条回答
  • 2021-01-20 21:29

    I have previously constructed tabhosts with an id of android:id="@+id/tabhost". Does this work for you?

    You could also consider constructing your tab view programmatically:

        TabHost t = getTabHost();
        TabSpec tab = t.newTabSpec(label)
                       .setIndicator(label, icon)
                       .setContent(intent);
        t.addTab(tab);
    
    0 讨论(0)
  • 2021-01-20 21:30

    even though i had changed my main.xml to use android:id="@android:id/tabhost" like the error stated, it kept trying to use the old name. finally i found the file res/layout-port/main.xml that was identical to main.xml except used the wrong android:id. i must have added a portrait view accidentally and it was holding on to the old value. either fixing the portrait file or removing it fixes my problem.

    0 讨论(0)
  • 2021-01-20 21:30

    I had this issue along with 'ERROR: Unknown option '--no-crunch''. If you updated ADT plug-in in Eclipse but have not updated the SDK at the same time. Updating the SDK Manager in Eclipse, fixed the issue for me.

    0 讨论(0)
  • 2021-01-20 21:35

    "public class NextActivity extends TabActivity" --change TabActivity to ActivityGroup.

    when problem happen when you want wo run tabhost in tabhost.it is ok.

    0 讨论(0)
  • 2021-01-20 21:44

    I had copied and pasted code and noticed that in the id attribute I had:

    android:id="@+id/tabs" 
    

    when what I really wanted was:

    android:id="@android:id/tabs"
    
    0 讨论(0)
  • 2021-01-20 21:48

    I had the same problem. Luckily there was a quick fix:

    1. Delete the R file.
    2. Wait for your IDE to generate the file.
    3. Profit!
    0 讨论(0)
提交回复
热议问题