仿抖音底部导航

本文介绍了如何在Android平台上实现仿抖音底部导航效果。通过在控件上添加动画,使用TextView作为底部指示横线,创建NavItemView类并重写相关方法如startActive()和cancelActive(),在Activity中进行调用来实现选中状态的切换。同时,文章还涵盖了自定义属性文件和Activity布局文件的配置细节。
摘要由CSDN通过智能技术生成

最终效果预览

最终效果

这次实现的是第一步效果

 

原理解析:通过对控件添加动画来实现仿抖音底部导航的效果

 

一.首先编写布局文件(这里是用TextView作为底部的指示横线)

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <LinearLayout
        android:layout_width="wrap_content"
        android:orientation="vertical"
        android:id="@+id/nav_top"
        android:layout_centerInParent="true"
        android:layout_height="wrap_content">
        <TextView
            android:layout_width="wrap_content"
            android:text="标题"
            android:id="@+id/nav_item_tv_title"
            android:textColor="#F1F1F1"
            android:textSize="16sp"
            android:layout_height="wrap_content" />
    </LinearLayout>
    <TextView
        android:layout_width="wrap_content"
        android:id="@+id/nav_item_tv_line"
        android:layout_below="@id/nav_top"
        an
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值