안드로이드 개발 질문/답변
(글 수 45,052)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TabHost android:id="@+id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TabWidget android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<FrameLayout android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingTop="62px">
</FrameLayout>
</TabHost>
</LinearLayout>
public class TabDemo extends Activity {
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
TabHost tabs = (TabHost) findViewById(R.id.tabhost);
tabs.setup();
TabHost.TabSpec spec = tabs.newTabSpec("tag1");
spec.setContent( new Intent(this, List1.class) );
// spec.setContent(R.id.tab1);
spec.setIndicator("LIST");
tabs.addTab(spec);
tabs.setCurrentTab(0);
}
}
위의 setContent 를 사용하면 에러가 나는 데 그 이유가 무엇인지 궁금합니다.
제가 제대로 구조를 이해 못해서 나는 에러 같은데
리소스로 호출할 경우에는 문제가 없는데
intent 호출한 경우 에러가 발생합니다.
탭 구조에 관련해서 궁금한 점이 많은데 정확히 어떤 부분을 봐야 하는지 모르겠습니다.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TabHost android:id="@+id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TabWidget android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<FrameLayout android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingTop="62px">
</FrameLayout>
</TabHost>
</LinearLayout>
public class TabDemo extends Activity {
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
TabHost tabs = (TabHost) findViewById(R.id.tabhost);
tabs.setup();
TabHost.TabSpec spec = tabs.newTabSpec("tag1");
spec.setContent( new Intent(this, List1.class) );
// spec.setContent(R.id.tab1);
spec.setIndicator("LIST");
tabs.addTab(spec);
tabs.setCurrentTab(0);
}
}
위의 setContent 를 사용하면 에러가 나는 데 그 이유가 무엇인지 궁금합니다.
제가 제대로 구조를 이해 못해서 나는 에러 같은데
리소스로 호출할 경우에는 문제가 없는데
intent 호출한 경우 에러가 발생합니다.
탭 구조에 관련해서 궁금한 점이 많은데 정확히 어떤 부분을 봐야 하는지 모르겠습니다.