Pia Sharma Pia Sharma - 20 days ago 10
Android Question

Bottom tab in android

Hi I am creating an android app in which I need to use bottom tab bar with selected item zoomed.
Anybody please help me to create this bottom bar. Here's the Screenshot that I want to get View]

Answer

There is a library you can use try to add as follow

compile 'com.github.armcha:SpaceNavigationView:1.4.2'

Xml

 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:tools="http://schemas.android.com/tools"
 xmlns:app="http://schemas.android.com/apk/res-auto"
 android:layout_width="match_parent"
 android:layout_height="match_parent">

  <...View
         ....
         android:layout_marginBottom="@dimen/view_bottom_margin" />

  <com.luseen.spacenavigation.SpaceNavigationView
         android:id="@+id/space"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:layout_gravity="bottom"/>

and you can set this in java like this

 SpaceNavigationView spaceNavigationView = (SpaceNavigationView) findViewById(R.id.space);
 spaceNavigationView.initWithSaveInstanceState(savedInstanceState);
 spaceNavigationView.addSpaceItem(new SpaceItem("HOME", R.drawable.yourDrawable));
 spaceNavigationView.addSpaceItem(new SpaceItem("SEARCH", R.drawable.yourDrawable));

and for more information

And if you want to make all item to be highlighted then you can try this library

compile "com.cleveroad:loopbar:1.0.1"

In xml use this

<com.cleveroad.loopbar.widget.LoopBarView
    android:id="@+id/endlessView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:enls_placeholderId="@id/placeHolder"
    app:enls_orientation="horizontal"
    app:enls_selectionGravity="start"
    app:enls_selectionMargin="10dp"
    app:enls_overlaySize="5dp"
    app:enls_selectionInAnimation="@animator/enls_scale_restore"
    app:enls_selectionOutAnimation="@animator/enls_scale_small"
    app:enls_selectionBackground="@android:color/holo_blue_dark"
    app:enls_menu="@menu/loopbar"
    />

and for more information lib2

Comments