Android 标签/TabActivity 深度研究
2010-06-19 17:46:00 来源:WEB开发网android:text="Hello to Johnny.Griffin!"
android:layout_centerInParent="true"
android:textStyle="bold|italic" />
< ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/robot"
android:layout_toLeftOf="@id/text" />
< /RelativeLayout>
< TextView
android:id="@+id/view2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="创新源于模仿!" />
< TextView
android:id="@+id/view3"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="欢迎进入 droid 世界!" />
android:id="@+id/view4"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/robot" />
< /FrameLayout>
< TabWidget
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
< /LinearLayout>
< /TabHost>
* 得到TabHost tHost 仅在TabActivity中有效
Java代码
tHost = this.getTabHost();
tHost = this.getTabHost();
* 创建4个标签 并指定所使用的布局
Java代码
public static final String Tab1 = "Tab1";
public static final String Tab2 = "Tab2";
public static final String Tab3 = "Tab3";
public static final String Tab4 = "Tab4";
public static final String Tab5 = "Tab5";
tHost.addTab(tHost.newTabSpec(Tab1).setIndicator("Tab 1", getResources().getDrawable(R.drawable.icon)).setContent(R.id.view1));
tHost.addTab(tHost.newTabSpec(Tab2).setIndicator("Tab 2",
Tags:Android 标签 TabActivity
编辑录入:coldstar [复制链接] [打 印]更多精彩
赞助商链接