您的位置:首页 > 其它

使用visibility属性在Tabhost里实现更改Tabs的内容

2015-11-25 21:39 302 查看
使用含有listview的tabhost的时候我想实现:点击listview中的子项时直接在原来的tabs里面显示网页,那么就是怎样实现tabs的更改问题,突然想到有一个visibility

android:visibility="gone" 其有三个属性:visible显示;invisible显示黑背景条;gone不显示,在类中,setVisibility(View.GONE);不显示 setVisibility(View.VISIBLE);显示。

于是就想着用他来实现,

<LinearLayout
android:id="@+id/ll_tab4"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<ImageView
android:id="@+id/img4_http"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/sgouchang01"
android:visibility="visible" >

</ImageView>

<ListView
android:id="@+id/lv_httphelp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="visible" >
</ListView>

<WebView
android:id="@+id/wv4_http"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
</LinearLayout>
</FrameLayout>
</LinearLayout>
</TabHost>


m4ListView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
// ((TextView) arg1.findViewById(R.id.tv4_httphelp))
// .setText(m4uri[arg2]);
jv_Home.this.findViewById(R.id.wv4_http).setVisibility(
View.VISIBLE);
jv_Home.this.findViewById(R.id.img4_http).setVisibility(
View.GONE);
jv_Home.this.findViewById(R.id.lv_httphelp).setVisibility(
View.GONE);
Log.e(TAG, "不可见被执行!");

}
});
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: