잘못된 부분좀 알려주세요.
탭 하단으로 내리는 문제 입니다.
xml 입니다.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:gravity="center_horizontal">
<TabHost android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<FrameLayout android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
</FrameLayout>
<TabWidget android:id="@android:id/tabs"
android:layout_alignParentBottom="true"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingTop="370px"
android:gravity="bottom"/>
</TabHost>
</LinearLayout>
java 소스 입니다.
public class A extends TabActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TabHost mTab = getTabHost();
LayoutInflater layout = LayoutInflater.from(this);
layout.inflate(xml, null);
TabSpec spec;
spec = mTab.newTabSpec("tag");
spec.setContent(new Intent(this, View1.class));
spec.setIndicator("1page");
mTab.addTab(spec);
spec = mTab.newTabSpec("tag");//(getString(R.string.smartmatch));
spec.setContent(new Intent(this, View2.class));
spec.setIndicator("2page");
mTab.addTab(spec);
spec = mTab.newTabSpec("tag");//(getString(R.string.smartmatch));
spec.setContent(new Intent(this, View3.class));
spec.setIndicator("3page");
mTab.addTab(spec);
}
}
위와 같이 코딩을 했습는데. 계속 위에 탭이 뜨네요.
검색 해 봐도 이 방식인거 같은데 왜 그럴까요?
한마디로 가져오기만 했지 아무데도 안쓴겁니다.
TabActivity는 기본 레이아웃이 있어서 setContentView를 따로 하지 않으면 그넘으로 적용이 됩니다.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TabHost android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
<FrameLayout android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
</FrameLayout>
<TabWidget android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
</TabHost>
</LinearLayout>




앞에 정의하신 XML이 쓰이긴 하나요? 여기서 사용되는 XML과 정의하신 XML이 같은건지 따져보실 필요가 있구요...
기왕 커스터마이징한 UI를 쓰시는것이라면 ActivityGroup 쓰시는게 나을듯합니다.