开发者

Eclipse add tabhost to project error

开发者 https://www.devze.com 2023-04-12 04:45 出处:网络
When I am trying to add a Ta开发者_JS百科bHost using RightClick > New > Android XML > Select Root Element :TabHost

When I am trying to add a Ta开发者_JS百科bHost using

RightClick > New > Android XML > Select Root Element :TabHost

It shows tabhost need a tabwidget and frame layout.

Actually tabhost is the root. How I can have a tabwidget and frame layout before ?

Is that fault of eclipse or mine ?


This feature should work as you described after installing ADK 2.3.3 update 2, using Eclipse 3.7.1.


I was able to create layout with root TabHost as you described on eclipse 3.7.1 with no errors. I belive as workaround you can create layout with LinearLayout as root and then either put TabHost inside it or switch LinearLayout with TabHost.

edit:

<?xml version="1.0" encoding="utf-8"?>
<TabHost
   xmlns:android="http://schemas.android.com/apk/res/android"
   android:orientation="vertical"
   android:layout_width="match_parent"
   android:layout_height="match_parent">
   <TabWidget
      android:id="@android:id/tabs"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content">
   </TabWidget>
   <FrameLayout
      android:id="@android:id/tabcontent" 
      android:layout_width="fill_parent"
      android:layout_height="wrap_content">
   </FrameLayout>  
</TabHost>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号