Android UI-实现底部切换标签(fragment)

android:layout_width=“0dp”

android:layout_height=“wrap_content”

android:layout_weight=“1.0” >

<ImageView

android:id=“@+id/iv_i_want_know”

android:layout_width=“wrap_content”

android:layout_height=“wrap_content”

android:layout_centerHorizontal=“true”

android:src=“@drawable/btn_wantknow_nor”

android:contentDescription=“@null” />

<TextView

android:id=“@+id/tv_i_want_know”

android:layout_width=“wrap_content”

android:layout_height=“wrap_content”

android:layout_below=“@+id/iv_i_want_know”

android:layout_centerHorizontal=“true”

android:text=“@string/bottom_tab_wantknow”

android:textColor=“@color/bottomtab_normal”

android:textSize=“12sp” />

<RelativeLayout

android:id=“@+id/rl_me”

android:layout_width=“0dp”

android:layout_height=“wrap_content”

android:layout_weight=“1.0” >

<ImageView

android:id=“@+id/iv_me”

android:layout_width=“wrap_content”

android:layout_height=“wrap_content”

android:layout_centerHorizontal=“true”

android:src=“@drawable/btn_my_nor”

android:contentDescription=“@null” />

<TextView

android:id=“@+id/tv_me”

android:layout_width=“wrap_content”

android:layout_height=“wrap_content”

android:layout_below=“@+id/iv_me”

android:layout_centerHorizontal=“true”

android:text=“@string/bottom_tab_my”

android:textColor=“@color/bottomtab_normal”

android:textSize=“12sp” />

<LinearLayout

android:id=“@+id/content_layout”

android:layout_width=“match_parent”

android:layout_height=“match_parent”

android:layout_above=“@+id/line”

android:layout_below=“@+id/top_tab”

android:orientation=“vertical” >

<View

android:id=“@+id/line”

android:layout_width=“match_parent”

android:layout_height=“1dp”

android:layout_above=“@id/ll_bottom_tab”

android:background=“@color/line” />

以上是布局代码,下面就介绍如何通过点击标签切换Fragment:

我们会发现,初始的时候是选中第一个标签页

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值