Android 底部突起 导航栏 实现 ClipChildren

            有个需求要实现底部的导航栏,但是图片是要凸起的,超越父控件的。。。原本想用radiobutton实现的,然后发现设置图片的时候无法设置准确大小和方向,而且代码动态设置的话,感觉也有点烦。。。所以直接5个布局,写死,然后自己手动换图片和文字颜色好了。。。先上效果图。。。



每个图片的大小也是不同的,这种布局方式出现的问题是,图片要超过父布局,这个时候就要用到clipChildren = false,默认是true就无法超过父布局。。。。

下面是activity的xml文件代码

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:fresco="http://schemas.android.com/apk/res-auto"
    xmlns:tl="http://schemas.android.com/apk/res-auto"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/main_drwaer_layout"
    android:orientation="vertical">
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:clipChildren="false"
        >

        <com.gogosu.gogosuandroid.util.NonScrollableViewPager
            android:id="@+id/fl_container"
            android:layout_width="match_parent"
            android:layout_marginBottom="54dp"
            android:layout_height="match_parent"
            />

       <LinearLayout
           android:layout_width="match_parent"
           android:layout_height="54dp"
           android:layout_alignParentBottom="true"
           android:background="@color/white"
           android:orientation="horizontal"
           android:clipChildren="false"
           >
           <RelativeLayout
               android:id="@+id/rl_home"
               android:layout_width="match_parent"
               android:layout_height="match_parent"
               android:layout_weight="1"
               android:clipChildren="false"
               >

               <TextView
                   android:id="@+id/tv_home"
                   android:layout_width="wrap_content"
                   android:layout_height="wrap_content"
                   android:text="首页"
                   style="@style/HomeNavigateTextStyle"
                   />
               <ImageView
                   android:id="@+id/iv_navi_home"
                   android:layout_width="35dp"
                   android:layout_height="35dp"
                   android:background="@drawable/selector_navi_home"
                   android:layout_above="@id/tv_home"
                   android:layout_centerHorizontal="true"
                   android:layout_marginBottom="3dp"
                   android:layout_marginTop="-5dp"

                   />

           </RelativeLayout>
           <RelativeLayout
               android:id="@+id/rl_tournament"
               android:layout_width="match_parent"
               android:layout_height="match_parent"
               android:layout_weight="
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值