PagerBottomTabStrip 使用教程
项目介绍
PagerBottomTabStrip 是一个遵循谷歌 Material Design 规范的 Android 底部导航栏控件。该项目在 GitHub 上拥有超过 2000 个 star,是一个非常受欢迎的开源项目。它不仅提供了美观的菜单样式,还支持点击效果和在菜单上显示数字等功能。
项目快速启动
添加依赖
首先,在你的 build.gradle
文件中添加以下依赖:
dependencies {
implementation 'com.github.tyzlmjj:PagerBottomTabStrip:latest-version'
}
请将 latest-version
替换为项目的最新版本号。
布局文件
在你的布局文件中添加 PagerBottomTabStrip
:
<com.tyzlmjj.pagerbottomtabstrip.PagerBottomTabStrip
android:id="@+id/tab"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:route="bottom_navigation"
app:tabPadding="8dp"
app:tabTextSize="14sp"
app:tabIconSize="24dp"
app:tabBackground="?attr/selectableItemBackground"
app:tabIndicatorColor="@color/colorPrimary"
app:tabTextColor="@color/colorPrimary"
app:tabSelectedTextColor="@color/colorAccent"
app:tabMode="fixed"
app:tabGravity="fill"
app:tabContentStart="0dp"
app:tabContentWidth="match_parent"
app:tabContentHeight="wrap_content"
app:tabContentPadding="0dp"
app:tabContentMargin="0dp"
app:tabContentBackground="@android:color/white"
app:tabContentAlpha="1.0"
app:tabContentScale="1.0"
app:tabContentRotation="0"
app:tabContentElevation="0dp"
app:tabContentTranslationZ="0dp"
app:tabContentTranslationY="0dp"
app:tabContentTranslationX="0dp"
app:tabContentScaleX="1.0"
app:tabContentScaleY="1.0"
app:tabContentRotationX="0"
app:tabContentRotationY="0"
app:tabContentPivotX="0.5"
app:tabContentPivotY="0.5"
app:tabContentAlphaAnimator="null"
app:tabContentScaleAnimator="null"
app:tabContentRotationAnimator="null"
app:tabContentTranslationAnimator="null"
app:tabContentElevationAnimator="null"
app:tabContentTranslationZAnimator="null"
app:tabContentTranslationYAnimator="null"
app:tabContentTranslationXAnimator="null"
app:tabContentScaleXAnimator="null"
app:tabContentScaleYAnimator="null"
app:tabContentRotationXAnimator="null"
app:tabContentRotationYAnimator="null"
app:tabContentPivotXAnimator="null"
app:tabContentPivotYAnimator="null"
app:tabContentAlphaAnimatorDuration="300"
app:tabContentScaleAnimatorDuration="300"
app:tabContentRotationAnimatorDuration="300"
app:tabContentTranslationAnimatorDuration="300"
app:tabContentElevationAnimatorDuration="300"
app:tabContentTranslationZAnimatorDuration="300"
app:tabContentTranslationYAnimatorDuration="300"
app:tabContentTranslationXAnimatorDuration="300"
app:tabContentScaleXAnimatorDuration="300"
app:tabContentScaleYAnimatorDuration="300"
app:tabContentRotationXAnimatorDuration="300"
app:tabContentRotationYAnimatorDuration="300"
app:tabContentPivotXAnimatorDuration="300"
app:tabContentPivotYAnimatorDuration="300"
app:tabContentAlphaAnimatorInterpolator="null"
app:tabContentScaleAnimatorInterpolator="null"
app:tabContentRotationAnimatorInterpolator="null"
app:tabContentTranslationAnimatorInterpolator="null"
app:tabContentElevationAnimatorInterpolator="null"