0
当试图在tabhost我得到这个错误嵌入tabhostTabhost Tabhost抛出运行时误差范围内(您的内容必须有一个TabHost其id属性为“android.R.id.tabhost”)
ava.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.tabdemo/com.example.tabdemo.Tab3Activity}: java.lang.RuntimeException: Your content must have a TabHost whose id attribute is 'android.R.id.tabhost'
从tab3.java我tabhost代码(是我想tabhost是在)
TabHost tabHost = getTabHost();
// Tab for login
TabHost.TabSpec Login = tabHost.newTabSpec("Login2");
// setting Title and Icon for the Tab
Login.setIndicator("", getApplicationContext().getResources().getDrawable(R.drawable.drawtab1));
Intent LoginIntent = new Intent(this, tab1InnerActivity.class);
LoginIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Login.setContent(LoginIntent);
tabHost.addTab(Login);
这是我目前tab3.xml
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="16dp"
android:background="#00547d"
>
<TextView
android:id="@+id/Job_Number_Label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Job Number"
android:textSize="20dp"
android:textColor="#ffffff" />
</LinearLayout>
</ScrollView>
我认为问题在于页面。