Android 标签/TabActivity 深度研究
2010-06-19 17:46:00 来源:WEB开发网< ImageView />
< TextView />
< /RelativeLayout>
< RelativeLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
< ImageView />
< TextView />
< /RelativeLayout>
< RelativeLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
< ImageView />
< TextView />
< /RelativeLayout>
< /LinearLayout>
* 去掉系统默认的布局 即 在 setIndicator() 中置空 修改如下:
Java代码
tHost.addTab(tHost.newTabSpec(Tab1).setIndicator("").setContent(ct));
tHost.addTab(tHost.newTabSpec(Tab1).setIndicator("").setContent(ct));
写道
可能有人会说:那我不调用setIndicator() 不久可以了么 不行 否则 会报错
* 自己定义布局 并 指定显示的内容
Java代码
public View composeLayout(String s, int i){
LinearLayout layout = new LinearLayout(this);
layout.setOrientation(LinearLayout.VERTICAL);
TextView tv = new TextView(this);
tv.setGravity(Gravity.CENTER);
tv.setSingleLine(true);
tv.setText(s);
layout.addView(tv,
new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
ImageView iv = new ImageView(this);
iv.setImageResource(i);
layout.addView(iv,
new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
return layout;
}
public View composeLayout(String s, int i){
LinearLayout layout = new LinearLayout(this);
layout.setOrientation(LinearLayout.VERTICAL);
Tags:Android 标签 TabActivity
编辑录入:coldstar [复制链接] [打 印]更多精彩
赞助商链接