Bubble Navigation 开源项目教程
项目介绍
Bubble Navigation 是一个用于 Android 的开源库,旨在提供一个易于使用且高度可定制的底部导航栏。该库允许开发者快速实现带有气泡动画效果的导航栏,从而增强用户界面的交互体验。Bubble Navigation 支持多种配置选项,包括不同的图标、文本、颜色和动画效果,使得开发者可以根据自己的需求轻松定制导航栏的外观和行为。
项目快速启动
添加依赖
首先,在您的 build.gradle
文件中添加以下依赖:
dependencies {
implementation 'com.github.gauravk95:bubble-navigation:1.0.3'
}
布局文件
在您的布局文件中添加 BubbleNavigationConstraintView
:
<com.gauravk.bubblenavigation.BubbleNavigationConstraintView
android:id="@+id/bottom_navigation_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@color/colorPrimary"
app:bnc_mode="spread"
app:bnc_badge_elevation="4dp">
<com.gauravk.bubblenavigation.BubbleToggleView
android:id="@+id/c_item_rest"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:bt_icon="@drawable/ic_restaurant"
app:bt_icon_tint="@color/white"
app:bt_title="@string/rest"
app:bt_badge_background_tint="@color/colorAccent"
app:bt_badge_text_color="@color/white"
app:bt_badge_text="10"
app:bt_badge_visible="true"
app:bt_badge_padding="2dp"
app:bt_badge_text_size="10sp"
app:bt_badge_margin="4dp"
app:bt_badge_gravity="top|end"
app:bt_badge_elevation="2dp"
app:bt_badge_corner_radius="10dp"
app:bt_badge_border_width="1dp"
app:bt_badge_border_color="@color/white"
app:bt_badge_background="@drawable/bg_badge"
app:bt_badge_background_color="@color/colorAccent"
app:bt_badge_background_drawable="@drawable/bg_badge"
app:bt_badge_background_tint_list="@color/colorAccent"
app:bt_badge_background_tint_mode="src_in"
app:bt_badge_background_tint="@color/colorAccent"
app:bt_badge_background_tint_list="@color/colorAccent"
app:bt_badge_background_tint_mode="src_in"
app:bt_badge_background_tint="@color/colorAccent"
app:bt_badge_background_tint_list="@color/colorAccent"
app:bt_badge_background_tint_mode="src_in"
app:bt_badge_background_tint="@color/colorAccent"
app:bt_badge_background_tint_list="@color/colorAccent"
app:bt_badge_background_tint_mode="src_in"
app:bt_badge_background_tint="@color/colorAccent"
app:bt_badge_background_tint_list="@color/colorAccent"
app:bt_badge_background_tint_mode="src_in"
app:bt_badge_background_tint="@color/colorAccent"
app:bt_badge_background_tint_list="@color/colorAccent"
app:bt_badge_background_tint_mode="src_in"
app:bt_badge_background_tint="@color/colorAccent"
app:bt_badge_background_tint_list="@color/colorAccent"
app:bt_badge_background_tint_mode="src_in"
app:bt_badge_background_tint="@color/colorAccent"
app:bt_badge_background_tint_list