Android自定义View之实现流行的底部菜单栏中间突起:高仿“咸鱼APP”的底部菜单。

编程入门 行业动态 更新时间:2024-10-09 06:26:13

Android自定义View之实现流行的底部菜单栏中间突起:高仿“<a href=https://www.elefans.com/category/jswz/34/1762853.html style=咸鱼APP”的底部菜单。"/>

Android自定义View之实现流行的底部菜单栏中间突起:高仿“咸鱼APP”的底部菜单。

自定义View之实现流行的底部菜单栏中间突起:高仿“咸鱼APP”的底部菜单。


博主一份努力,转载请支持原创:


一、好奇心在作怪。

  • 今天纳闷地看了看咸鱼,看见其底部的菜单栏效果还不错,中间那个按钮是凸起来的!


  • 再看看我撸的界面:


2、何谓重要的属性 android:clipChildren=”false”。

  • 上网查询 ,该属性解释为,可以允许其子控件超过父控件,于是乎,按照一般的想法,都是以下的代码,但是发现中间那个按钮有点缺陷的!


  • 但是,我们把这个 android:clipChildren=”false” 代码撸上之后,就下图了,是不是很神秘!


3、完整的代码。


<RelativeLayout xmlns:android=""android:layout_width="match_parent"android:layout_height="match_parent"android:clipChildren="false"><LinearLayout
        android:id="@+id/ll_bottom"android:layout_width="match_parent"android:layout_height="60dp"android:layout_alignParentBottom="true"android:orientation="horizontal"><RelativeLayout
            android:layout_width="0dp"android:layout_height="match_parent"android:layout_gravity="bottom"android:layout_weight="1"><ImageView
                android:id="@+id/dd"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerInParent="true"android:src="@mipmap/ic_tab_home_normal" /><TextView
                android:padding="2dp"android:textSize="10sp"android:layout_centerInParent="true"android:text="首页"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_below="@+id/dd"/></RelativeLayout><RelativeLayout
            android:layout_width="0dp"android:layout_height="match_parent"android:layout_gravity="bottom"android:layout_weight="1"><ImageView
                android:id="@+id/dd2"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerInParent="true"android:src="@mipmap/ic_tab_var_normal" /><TextView
                android:padding="2dp"android:textSize="10sp"android:layout_centerInParent="true"android:text="鱼塘"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_below="@+id/dd2"/></RelativeLayout><RelativeLayout
            android:layout_width="100dp"android:layout_height="90dp"android:layout_gravity="bottom"><ImageView
                android:id="@+id/dd5"android:layout_width="60dp"android:layout_height="60dp"android:layout_centerInParent="true"android:src="@mipmap/ic_tab_add" /><TextView
                android:padding="2dp"android:textSize="10sp"android:layout_centerInParent="true"android:text="添加"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_below="@+id/dd5"/></RelativeLayout><RelativeLayout
            android:layout_width="0dp"android:layout_height="match_parent"android:layout_gravity="bottom"android:layout_weight="1"><ImageView
                android:id="@+id/dd3"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerInParent="true"android:src="@mipmap/ici_tab_scence_normal" /><TextView
                android:padding="2dp"android:textSize="10sp"android:layout_centerInParent="true"android:text="消息"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_below="@+id/dd3"/></RelativeLayout><RelativeLayout
            android:layout_width="0dp"android:layout_height="match_parent"android:layout_gravity="bottom"android:layout_weight="1"><ImageView
                android:id="@+id/dd4"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerInParent="true"android:src="@mipmap/ic_tab_mine_normal" /><TextView
                android:padding="2dp"android:textSize="10sp"android:layout_centerInParent="true"android:text="我的"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_below="@+id/dd4"/></RelativeLayout>></LinearLayout></RelativeLayout>

  • 后期还会显示该APP的弹出效果,如下:


  • 敬请期待~

更多推荐

Android自定义View之实现流行的底部菜单栏中间突起:高仿“咸鱼APP”的底部菜单。

本文发布于:2024-02-14 07:50:20,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1762754.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:咸鱼   自定义   突起   菜单栏   菜单

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!