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

来源:互联网 发布:淘宝卖的ipad是真的吗 编辑:程序博客网 时间:2024/05/06 15:48

            使用含有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() {@Overridepublic 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, "不可见被执行!");}});


0 0
原创粉丝点击