<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>app design guidelines Archives - Truiton</title>
	<atom:link href="https://www.truiton.com/tag/app-design-guidelines/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>Technology Reaching Us In Time - Online</description>
	<lastBuildDate>Sun, 01 Sep 2019 09:52:33 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://i0.wp.com/www.truiton.com/wp-content/uploads/2022/11/cropped-truiton_new_logo_half_white.png?fit=32%2C32&#038;ssl=1</url>
	<title>app design guidelines Archives - Truiton</title>
	<link></link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">54534495</site>	<item>
		<title>Android Bottom Navigation Bar Example</title>
		<link>https://www.truiton.com/2017/01/android-bottom-navigation-bar-example/</link>
					<comments>https://www.truiton.com/2017/01/android-bottom-navigation-bar-example/#comments</comments>
		
		<dc:creator><![CDATA[Mohit Gupt]]></dc:creator>
		<pubDate>Sat, 28 Jan 2017 14:23:50 +0000</pubDate>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[app design guidelines]]></category>
		<category><![CDATA[Design Support Library]]></category>
		<category><![CDATA[Material Design]]></category>
		<guid isPermaLink="false">http://www.truiton.com/?p=1666</guid>

					<description><![CDATA[<p>Its been a while since Google introduced Material Design, but recently with Design Support Library v25&#160;they released a new widget to make an Android Bottom Navigation Bar, as described in the official material design specs. This new navigation component is called the&#160;BottomNavigationView and as mentioned, its packaged under the design support library, having full backward&#8230;&#160;<a href="https://www.truiton.com/2017/01/android-bottom-navigation-bar-example/" rel="bookmark">Read More &#187;<span class="screen-reader-text">Android Bottom Navigation Bar Example</span></a></p>
<p>The post <a href="https://www.truiton.com/2017/01/android-bottom-navigation-bar-example/">Android Bottom Navigation Bar Example</a> appeared first on <a href="https://www.truiton.com">Truiton</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<div class="wp-block-image"><figure class="aligncenter"><img data-recalc-dims="1" fetchpriority="high" decoding="async" width="950" height="530" data-attachment-id="1671" data-permalink="https://www.truiton.com/2017/01/android-bottom-navigation-bar-example/android-bottom-navigation-bar-featured/" data-orig-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2017/01/Android-Bottom-Navigation-Bar-Featured.jpg?fit=950%2C530&amp;ssl=1" data-orig-size="950,530" data-comments-opened="1" data-image-title="Android Bottom Navigation Bar &amp;#8211; Featured" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2017/01/Android-Bottom-Navigation-Bar-Featured.jpg?fit=950%2C530&amp;ssl=1" src="https://i0.wp.com/www.truiton.com/wp-content/uploads/2017/01/Android-Bottom-Navigation-Bar-Featured.jpg?resize=950%2C530" alt="Android Bottom Navigation Bar" class="wp-image-1671" srcset="https://i0.wp.com/www.truiton.com/wp-content/uploads/2017/01/Android-Bottom-Navigation-Bar-Featured.jpg?w=950&amp;ssl=1 950w, https://i0.wp.com/www.truiton.com/wp-content/uploads/2017/01/Android-Bottom-Navigation-Bar-Featured.jpg?resize=600%2C335&amp;ssl=1 600w, https://i0.wp.com/www.truiton.com/wp-content/uploads/2017/01/Android-Bottom-Navigation-Bar-Featured.jpg?resize=300%2C167&amp;ssl=1 300w, https://i0.wp.com/www.truiton.com/wp-content/uploads/2017/01/Android-Bottom-Navigation-Bar-Featured.jpg?resize=768%2C428&amp;ssl=1 768w" sizes="(max-width: 950px) 100vw, 950px" /></figure></div>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">Its been a while since Google introduced <a href="http://www.truiton.com/2015/02/android-material-design-backward-compatibility/" target="_blank" rel="noopener noreferrer">Material Design</a>, but recently with <a href="https://developer.android.com/topic/libraries/support-library/revisions.html#rev25-0-0" target="_blank" rel="noopener noreferrer">Design Support Library v25</a>&nbsp;they released a new widget to make an Android Bottom Navigation Bar, as described in the <a href="https://material.io/guidelines/components/bottom-navigation.html" target="_blank" rel="noopener noreferrer">official material design</a> specs. This new navigation component is called the&nbsp;<a href="https://developer.android.com/reference/android/support/design/widget/BottomNavigationView.html" target="_blank" rel="noopener noreferrer">BottomNavigationView</a> and as mentioned, its packaged under the design support library, having full backward support. Although if you browse the internet, you may find many examples, showing how to implement an Android bottom navigation bar. But this new Android BottomNavigationView widget makes it very easy for the developers to build and deploy apps with bottom navigation, as its an&nbsp;official component.</p>



<h2 class="wp-block-heading">Android BottomNavigationView Widget</h2>



<p class="wp-block-paragraph">At first when you look at the new BottomNavigationView widget it may look similar to the <code>TabLayout</code> of the same library. But but do not get confused, as its implementation is a lot different than that of the&nbsp;later one. As the new bottom bar navigation implementation of Android is based out of&nbsp;menu items. Hence to populate a <code>BottomNavigationView</code> you need to specify a menu resource file, unlike in the <code>TabLayout</code>. Although if you look at the final output i.e. the screen, there is still a striking similarity between the two. But putting this discussion to rest, lets have a look at the new features of the Android BottomNavigationView.</p>



<p class="wp-block-paragraph">Whenever a new component is introduced, along with it some new methods and attributes are also added with it. Hence with the Android&#8217;s official bottom navigation widget the&nbsp;<a href="https://developer.android.com/reference/android/support/design/widget/BottomNavigationView.html" target="_blank" rel="noopener noreferrer">BottomNavigationView</a>&nbsp;following new XML attributes are added:</p>



<ul class="wp-block-list"><li><code><code></code></code><a href="https://developer.android.com/reference/android/support/design/widget/BottomNavigationView.html#attr_android.support.design:itemBackground" target="_blank" rel="noopener noreferrer">android.support.design:itemBackground</a>&nbsp;&#8211; It is used to set the background color of the navigation item. It does not take a <a href="https://developer.android.com/reference/android/content/res/ColorStateList.html" target="_blank" rel="noopener noreferrer">ColorStateList</a>, as per design specifications.</li><li><code><code></code></code><a href="https://developer.android.com/reference/android/support/design/widget/BottomNavigationView.html#attr_android.support.design:itemIconTint" target="_blank" rel="noopener noreferrer">android.support.design:itemIconTint</a>&nbsp;&#8211; It is used to set the icon tint color, use a&nbsp;<a href="https://developer.android.com/reference/android/content/res/ColorStateList.html" target="_blank" rel="noopener noreferrer">ColorStateList</a>&nbsp;to specify colors for all states.</li><li><code><code></code></code><a href="https://developer.android.com/reference/android/support/design/widget/BottomNavigationView.html#attr_android.support.design:itemTextColor" target="_blank" rel="noopener noreferrer">android.support.design:itemTextColor</a>&nbsp;&#8211; It is used to set the text color of the navigation item,&nbsp;use a&nbsp;<a href="https://developer.android.com/reference/android/content/res/ColorStateList.html" target="_blank" rel="noopener noreferrer">ColorStateList</a>&nbsp;to specify colors for all states.</li></ul>



<div class="wp-block-image"><figure class="aligncenter"><img data-recalc-dims="1" decoding="async" width="600" height="120" data-attachment-id="1673" data-permalink="https://www.truiton.com/2017/01/android-bottom-navigation-bar-example/android-bottom-navigation-bar-1/" data-orig-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2017/01/android-bottom-navigation-bar-1.jpg?fit=600%2C120&amp;ssl=1" data-orig-size="600,120" data-comments-opened="1" data-image-title="android-bottom-navigation-bar-1" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2017/01/android-bottom-navigation-bar-1.jpg?fit=600%2C120&amp;ssl=1" src="https://i0.wp.com/www.truiton.com/wp-content/uploads/2017/01/android-bottom-navigation-bar-1.jpg?resize=600%2C120" alt="android bottom navigation bar" class="wp-image-1673" srcset="https://i0.wp.com/www.truiton.com/wp-content/uploads/2017/01/android-bottom-navigation-bar-1.jpg?w=600&amp;ssl=1 600w, https://i0.wp.com/www.truiton.com/wp-content/uploads/2017/01/android-bottom-navigation-bar-1.jpg?resize=300%2C60&amp;ssl=1 300w" sizes="(max-width: 600px) 100vw, 600px" /></figure></div>



<p class="wp-block-paragraph">As I mentioned&nbsp;<code>BottomNavigationView</code> takes a <a href="https://developer.android.com/guide/topics/resources/menu-resource.html" target="_blank" rel="noopener noreferrer">menu resource</a> file to inflate the navigation items. To do so following are the ways in which it can be done:</p>



<ul class="wp-block-list"><li>XML
<ul>
<li><a href="https://developer.android.com/reference/android/support/design/widget/BottomNavigationView.html#inflateMenu(int)" target="_blank" rel="noopener noreferrer"><code>app:menu</code></a></li>
</ul>
</li><li>Java
<ul>
<li><code><code></code></code><a href="https://developer.android.com/reference/android/support/design/widget/BottomNavigationView.html#inflateMenu(int)" target="_blank" rel="noopener noreferrer">BottomNavigationView.inflateMenu()</a></li>
</ul>
</li></ul>



<p class="wp-block-paragraph">Once a <code>BottomNavigationView</code> is inflated and visible, a click listener can be attached to it:</p>



<ul class="wp-block-list"><li><code><code></code></code><a href="https://developer.android.com/reference/android/support/design/widget/BottomNavigationView.OnNavigationItemSelectedListener.html" target="_blank" rel="noopener noreferrer">BottomNavigationView.OnNavigationItemSelectedListener</a></li></ul>



<p class="wp-block-paragraph">Method used to select a specific item in the BottomNavigationView:</p>



<ul class="wp-block-list"><li><code>BottomNavigationView.getMenu().getItem(index).setChecked(true);</code></li></ul>



<p class="wp-block-paragraph">Although this component gives us the&nbsp;flexibility of changing screen content dynamically. But it is advised to not implement <a href="https://material.io/guidelines/components/bottom-navigation.html#bottom-navigation-behavior" target="_blank" rel="noopener noreferrer">swiping views</a>&nbsp;with an Android bottom navigation bar as per specs. Therefore&nbsp;this rules out the possibility of using a ViewPager with the bottom navigation bar. Instead a simple view or a set of fragments for complex implementation can be used. Therefore here in this tutorial, I will show how to implement a BottomNavigationView with a set of fragments.&nbsp;Lets have look at the example below.</p>



<h2 class="wp-block-heading">Android Bottom Navigation Bar Example</h2>



<p class="wp-block-paragraph">To demonstrate a working example of Android BottomNavigationView widget, I would make three fragments and switch between them by using the bottom navigation bar.&nbsp;Here are the steps:</p>



<h3 class="wp-block-heading">Step 1 : Add the dependencies</h3>



<p class="wp-block-paragraph">To start off with an example of bottom navigation bar on android , first we need to include following dependencies in our build.gradle file.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:design:25.1.0'
compile 'com.android.support:support-v4:25.1.0'</pre>



<h3 class="wp-block-heading">&nbsp;</h3>



<h3 class="wp-block-heading">Step 2 : Define the Fragments</h3>



<p class="wp-block-paragraph">For this example I&nbsp;will be building a screen with three fragments, which could be switched by the BottomNavigationView. Hence before jumping on to the main screen, lets define three fragments.</p>



<p class="wp-block-paragraph">Fragment 1:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="xml" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:tools="http://schemas.android.com/tools"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                tools:context="com.truiton.bottomnavigation.ItemOneFragment">

    &lt;ImageView
        android:id="@+id/truiton_image"
        android:layout_width="300dp"
        android:layout_height="300dp"
        android:layout_centerInParent="true"
        android:src="@mipmap/truiton"/>

    &lt;TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/truiton_image"
        android:layout_centerHorizontal="true"
        android:text="Fragment 1"
        android:textSize="30sp"/>

&lt;/RelativeLayout>
</pre>



<pre class="EnlighterJSRAW" data-enlighter-language="java" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">package com.truiton.bottomnavigation;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

public class ItemOneFragment extends Fragment {
    public static ItemOneFragment newInstance() {
        ItemOneFragment fragment = new ItemOneFragment();
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_item_one, container, false);
    }
}
</pre>



<p class="wp-block-paragraph">Fragment 2:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="xml" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:tools="http://schemas.android.com/tools"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                tools:context="com.truiton.bottomnavigation.ItemTwoFragment">

    &lt;ImageView
        android:id="@+id/truiton_image"
        android:layout_width="300dp"
        android:layout_height="300dp"
        android:layout_centerInParent="true"
        android:src="@mipmap/truiton"/>

    &lt;TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/truiton_image"
        android:layout_centerHorizontal="true"
        android:text="Fragment 2"
        android:textSize="30sp"/>

&lt;/RelativeLayout>
</pre>



<pre class="EnlighterJSRAW" data-enlighter-language="java" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">package com.truiton.bottomnavigation;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

public class ItemTwoFragment extends Fragment {
    public static ItemTwoFragment newInstance() {
        ItemTwoFragment fragment = new ItemTwoFragment();
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_item_two, container, false);
    }
}
</pre>



<p class="wp-block-paragraph">Fragment 3:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="xml" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:tools="http://schemas.android.com/tools"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                tools:context="com.truiton.bottomnavigation.ItemThreeFragment">

    &lt;ImageView
        android:id="@+id/truiton_image"
        android:layout_width="300dp"
        android:layout_height="300dp"
        android:layout_centerInParent="true"
        android:src="@mipmap/truiton"/>

    &lt;TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/truiton_image"
        android:layout_centerHorizontal="true"
        android:text="Fragment 3"
        android:textSize="30sp"/>

&lt;/RelativeLayout>
</pre>



<pre class="EnlighterJSRAW" data-enlighter-language="java" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">package com.truiton.bottomnavigation;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

public class ItemThreeFragment extends Fragment {
    public static ItemThreeFragment newInstance() {
        ItemThreeFragment fragment = new ItemThreeFragment();
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_item_three, container, false);
    }
}
</pre>



<h3 class="wp-block-heading">Step 3 : Defining the bottom navigation menu XML</h3>



<p class="wp-block-paragraph">As mentioned before to populate the actual items into an&nbsp;Android bottom navigation bar, a menu type XML is used. This XML should contain at minimum three attributes:</p>



<ul class="wp-block-list"><li>android:title</li><li>android:icon</li><li>android:id</li></ul>



<p class="wp-block-paragraph">For this example of BottomNavigationView, I would make a menu of three items:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="xml" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;?xml version="1.0" encoding="utf-8"?>
&lt;menu xmlns:android="http://schemas.android.com/apk/res/android">
    &lt;item
        android:id="@+id/action_item1"
        android:icon="@drawable/ic_account_box_black_24dp"
        android:title="@string/item_1"/>
    &lt;item
        android:id="@+id/action_item2"
        android:icon="@drawable/ic_account_circle_black_24dp"
        android:title="@string/item_2"/>
    &lt;item
        android:id="@+id/action_item3"
        android:icon="@drawable/ic_assignment_ind_black_24dp"
        android:title="@string/item_3"/>
&lt;/menu></pre>



<h3 class="wp-block-heading">Step 4 : Defining the Activity XML</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="xml" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;?xml version="1.0" encoding="utf-8"?>
&lt;RelativeLayout
    android:id="@+id/activity_main"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.truiton.bottomnavigation.MainActivity">

    &lt;FrameLayout
        android:id="@+id/frame_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@+id/navigation"
        android:animateLayoutChanges="true">

    &lt;/FrameLayout>

    &lt;android.support.design.widget.BottomNavigationView
        android:id="@+id/navigation"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:background="@color/colorPrimary"
        app:itemIconTint="@color/nav_item_state_list"
        app:itemTextColor="@color/nav_item_state_list"
        app:menu="@menu/bottom_navigation_items"/>
&lt;/RelativeLayout>
</pre>



<p class="wp-block-paragraph">As you can see above, for attributes&nbsp;<code>app:itemIconTint</code> and <code>app:itemTextColor</code>, I have used a&nbsp;<a href="https://developer.android.com/reference/android/content/res/ColorStateList.html" target="_blank" rel="noopener noreferrer">ColorStateList</a>. Please make sure when you make a color state list, its according to the <a href="https://material.io/guidelines/components/bottom-navigation.html" target="_blank" rel="noopener noreferrer">Material design specs</a> for bottom navigation bar. Full source code is available at the end of the tutorial.</p>



<h3 class="wp-block-heading">&nbsp;</h3>



<h3 class="wp-block-heading">Step 5 : Defining the activity with bottom navigation bar</h3>



<pre class="EnlighterJSRAW" data-enlighter-language="java" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">package com.truiton.bottomnavigation;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.BottomNavigationView;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.view.MenuItem;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        BottomNavigationView bottomNavigationView = (BottomNavigationView)
                findViewById(R.id.navigation);

        bottomNavigationView.setOnNavigationItemSelectedListener
                (new BottomNavigationView.OnNavigationItemSelectedListener() {
                    @Override
                    public boolean onNavigationItemSelected(@NonNull MenuItem item) {
                        Fragment selectedFragment = null;
                        switch (item.getItemId()) {
                            case R.id.action_item1:
                                selectedFragment = ItemOneFragment.newInstance();
                                break;
                            case R.id.action_item2:
                                selectedFragment = ItemTwoFragment.newInstance();
                                break;
                            case R.id.action_item3:
                                selectedFragment = ItemThreeFragment.newInstance();
                                break;
                        }
                        FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
                        transaction.replace(R.id.frame_layout, selectedFragment);
                        transaction.commit();
                        return true;
                    }
                });

        //Manually displaying the first fragment - one time only
        FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
        transaction.replace(R.id.frame_layout, ItemOneFragment.newInstance());
        transaction.commit();

        //Used to select an item programmatically
        //bottomNavigationView.getMenu().getItem(2).setChecked(true);
    }
}
</pre>



<p class="wp-block-paragraph">As you can see above when making a screen with the help of BottomNavigationView we have to initialize it with a default view. As there is no <code>ViewPager</code> here, we are doing it all manually. By default when a <code>BottomNavigationView</code> is initialized it is loaded with the first item selected. But&nbsp;if you wish to load the screen with any other item selected, you can do so by getting the menu item and setting it checked as shown above. For full source code, please refer to the following link:</p>



<p class="wp-block-paragraph" style="text-align:center"><a class="fasc-button fasc-size-large fasc-type-flat fasc-rounded-medium ico-fa fasc-ico-before fa-github" style="background-color: #0364af; color: #ffffff;" target="_blank" rel="noopener noreferrer" href="https://github.com/Truiton/BottomNavigation">Full Source Code</a></p>



<p class="wp-block-paragraph">The final output would look like this:</p>



<div class="wp-block-image"><figure class="aligncenter"><img data-recalc-dims="1" decoding="async" width="600" height="967" data-attachment-id="1676" data-permalink="https://www.truiton.com/2017/01/android-bottom-navigation-bar-example/android-bottom-navigation-bar-2/" data-orig-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2017/01/Android-bottom-navigation-bar-2.png?fit=600%2C967&amp;ssl=1" data-orig-size="600,967" data-comments-opened="1" data-image-title="Android bottom navigation bar -2" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2017/01/Android-bottom-navigation-bar-2.png?fit=600%2C967&amp;ssl=1" src="https://i0.wp.com/www.truiton.com/wp-content/uploads/2017/01/Android-bottom-navigation-bar-2.png?resize=600%2C967" alt="Android bottom navigation bar" class="wp-image-1676" srcset="https://i0.wp.com/www.truiton.com/wp-content/uploads/2017/01/Android-bottom-navigation-bar-2.png?w=600&amp;ssl=1 600w, https://i0.wp.com/www.truiton.com/wp-content/uploads/2017/01/Android-bottom-navigation-bar-2.png?resize=186%2C300&amp;ssl=1 186w, https://i0.wp.com/www.truiton.com/wp-content/uploads/2017/01/Android-bottom-navigation-bar-2.png?resize=300%2C484&amp;ssl=1 300w" sizes="(max-width: 600px) 100vw, 600px" /></figure></div>



<h2 class="wp-block-heading">BottomNavigationView Limitations</h2>



<p class="wp-block-paragraph">Although the view itself is recently released, hence it is bound to have some issues. But if you are trying to build an Android screen with bottom navigation, here is a list of&nbsp;issues you might face:</p>



<ul class="wp-block-list"><li>Item Background cannot be colored for selected state.</li><li>It does not have a bottom navigation behavior, hence no integration is available for FAB, Snackbar, and CoordinatorLayout.</li><li>Ethically swiping of views should not be done &#8211; Stated in <a href="https://material.io/guidelines/components/bottom-navigation.html" target="_blank" rel="noopener noreferrer">Material Design guidelines</a>.</li><li>Text and icon sizes cannot be changed.</li><li>No way to hide title for non selected items.</li><li>Only 5 items can be added at a time.</li></ul>



<p class="wp-block-paragraph">But besides all this, building an Android bottom navigation bar has become a lot more simpler with the new BottomNavigationBar widget. As this is the new official component for bottom navigation.&nbsp;Also when speaking of shaping a product, giving upfront options like the bottom navigation has always gotten more traction,&nbsp;since it presents all the options to a user right away. Hope this helped, follow us on Twitter, Facebook and Google+ for more updates.</p>
<div class="saboxplugin-wrap" itemtype="http://schema.org/Person" itemscope itemprop="author"><div class="saboxplugin-tab"><div class="saboxplugin-gravatar"><img alt='Mohit Gupt' src='https://secure.gravatar.com/avatar/a816092ad56645d2635ccfceb9f7e9d44821c19dec126cb394c882ba574eaa04?s=100&#038;d=mm&#038;r=g' srcset='https://secure.gravatar.com/avatar/a816092ad56645d2635ccfceb9f7e9d44821c19dec126cb394c882ba574eaa04?s=200&#038;d=mm&#038;r=g 2x' class='avatar avatar-100 photo' height='100' width='100' itemprop="image"/></div><div class="saboxplugin-authorname"><a href="https://www.truiton.com/author/mohitgupt/" class="vcard author" rel="author"><span class="fn">Mohit Gupt</span></a></div><div class="saboxplugin-desc"><div itemprop="description"><p>Born in New Delhi, India. A software engineer by profession, an android enthusiast and mobile development evangelist. My motive here is to create a group of skilled engineers, who can build better software. Reason being programming is my passion, and also it feels good to make a device do something you want. Professionally I have worked with many software engineering and product development firms. As of now too, I am employed as a senior engineer in a leading tech company. In total I may have worked on more than 20 projects professionally, but whenever I get spare time I share my thoughts here at Truiton.</p>
</div></div><div class="saboxplugin-web "><a href="http://www.truiton.com" target="_self" >www.truiton.com</a></div><div class="clearfix"></div><div class="saboxplugin-socials "><a title="Wordpress" target="_blank" href="https://www.truiton.com/author/mohitgupt/" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-wordpress" role="img" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 512 512"><path fill="currentColor" d="M61.7 169.4l101.5 278C92.2 413 43.3 340.2 43.3 256c0-30.9 6.6-60.1 18.4-86.6zm337.9 75.9c0-26.3-9.4-44.5-17.5-58.7-10.8-17.5-20.9-32.4-20.9-49.9 0-19.6 14.8-37.8 35.7-37.8.9 0 1.8.1 2.8.2-37.9-34.7-88.3-55.9-143.7-55.9-74.3 0-139.7 38.1-177.8 95.9 5 .2 9.7.3 13.7.3 22.2 0 56.7-2.7 56.7-2.7 11.5-.7 12.8 16.2 1.4 17.5 0 0-11.5 1.3-24.3 2l77.5 230.4L249.8 247l-33.1-90.8c-11.5-.7-22.3-2-22.3-2-11.5-.7-10.1-18.2 1.3-17.5 0 0 35.1 2.7 56 2.7 22.2 0 56.7-2.7 56.7-2.7 11.5-.7 12.8 16.2 1.4 17.5 0 0-11.5 1.3-24.3 2l76.9 228.7 21.2-70.9c9-29.4 16-50.5 16-68.7zm-139.9 29.3l-63.8 185.5c19.1 5.6 39.2 8.7 60.1 8.7 24.8 0 48.5-4.3 70.6-12.1-.6-.9-1.1-1.9-1.5-2.9l-65.4-179.2zm183-120.7c.9 6.8 1.4 14 1.4 21.9 0 21.6-4 45.8-16.2 76.2l-65 187.9C426.2 403 468.7 334.5 468.7 256c0-37-9.4-71.8-26-102.1zM504 256c0 136.8-111.3 248-248 248C119.2 504 8 392.7 8 256 8 119.2 119.2 8 256 8c136.7 0 248 111.2 248 248zm-11.4 0c0-130.5-106.2-236.6-236.6-236.6C125.5 19.4 19.4 125.5 19.4 256S125.6 492.6 256 492.6c130.5 0 236.6-106.1 236.6-236.6z"></path></svg></span></a><a title="Twitter" target="_blank" href="http://twitter.com/mohitgupt" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-twitter" role="img" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 30 30"><path d="M26.37,26l-8.795-12.822l0.015,0.012L25.52,4h-2.65l-6.46,7.48L11.28,4H4.33l8.211,11.971L12.54,15.97L3.88,26h2.65 l7.182-8.322L19.42,26H26.37z M10.23,6l12.34,18h-2.1L8.12,6H10.23z" /></svg></span></a><a title="Facebook" target="_blank" href="https://www.facebook.com/Mr.Mohit.Gupt" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-facebook" role="img" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 264 512"><path fill="currentColor" d="M76.7 512V283H0v-91h76.7v-71.7C76.7 42.4 124.3 0 193.8 0c33.3 0 61.9 2.5 70.2 3.6V85h-48.2c-37.8 0-45.1 18-45.1 44.3V192H256l-11.7 91h-73.6v229"></path></svg></span></a></div></div></div><p>The post <a href="https://www.truiton.com/2017/01/android-bottom-navigation-bar-example/">Android Bottom Navigation Bar Example</a> appeared first on <a href="https://www.truiton.com">Truiton</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.truiton.com/2017/01/android-bottom-navigation-bar-example/feed/</wfw:commentRss>
			<slash:comments>20</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1666</post-id>	</item>
		<item>
		<title>Should iPhone and android apps have same interface ?</title>
		<link>https://www.truiton.com/2013/03/should-iphone-and-android-apps-have-same-interface/</link>
					<comments>https://www.truiton.com/2013/03/should-iphone-and-android-apps-have-same-interface/#comments</comments>
		
		<dc:creator><![CDATA[Mohit Gupt]]></dc:creator>
		<pubDate>Fri, 08 Mar 2013 17:52:36 +0000</pubDate>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[android delete]]></category>
		<category><![CDATA[app design guidelines]]></category>
		<category><![CDATA[consistent app design]]></category>
		<category><![CDATA[iPhone android app same interface]]></category>
		<category><![CDATA[iPhone delete]]></category>
		<category><![CDATA[same app different interface]]></category>
		<category><![CDATA[same app same interface]]></category>
		<category><![CDATA[same interface]]></category>
		<category><![CDATA[same UI]]></category>
		<guid isPermaLink="false">http://blog.truiton.com/?p=30</guid>

					<description><![CDATA[<p>Well the answer to that  question is a big NO !! Being a mobile app consultant at Truiton I can understand your pain of getting the design team to redesign an app&#8217;s interface again for the other platform. But trust me that&#8217;s the right thing to do. What I believe is if an app is&#8230;&#160;<a href="https://www.truiton.com/2013/03/should-iphone-and-android-apps-have-same-interface/" rel="bookmark">Read More &#187;<span class="screen-reader-text">Should iPhone and android apps have same interface ?</span></a></p>
<p>The post <a href="https://www.truiton.com/2013/03/should-iphone-and-android-apps-have-same-interface/">Should iPhone and android apps have same interface ?</a> appeared first on <a href="https://www.truiton.com">Truiton</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Well the answer to that  question is a big NO !!</p>
<p>Being a mobile app consultant at <a href="http://www.truiton.com">Truiton</a> I can understand your pain of getting the design team to redesign an app&#8217;s interface again for the other platform. But trust me that&#8217;s the right thing to do. What I believe is if an app is being developed for both platforms, i.e. iPhone and android, then it should have the same user experience but NOT the same UI. As when user bought his phone he decided to go with the interface of that platform, as he liked it more than its counterpart, then who you to choose for him that this platform or that platform&#8217;s UI is better !</p>
<p>In software industry we are advised to maintain consistency in every aspect of software development, but it doesn&#8217;t mean we develop apps for different platforms with same UI. In a post somewhere I read a dude saying something like &#8221; consider a case where I have an iPhone and show an app to a friend of mine and he downloads it it on his Android phone but its not as good as iPhone one, then what&#8221; &#8211; WELL DUDE, either code your android app in a better way or get an IPHONE !!</p>
<p><figure id="attachment_38" aria-describedby="caption-attachment-38" style="width: 590px" class="wp-caption aligncenter"><a href="https://i0.wp.com/www.truiton.com/wp-content/uploads/2013/03/post_Image.png"><img data-recalc-dims="1" loading="lazy" decoding="async" data-attachment-id="38" data-permalink="https://www.truiton.com/2013/03/should-iphone-and-android-apps-have-same-interface/post_image/" data-orig-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2013/03/post_Image.png?fit=590%2C150&amp;ssl=1" data-orig-size="590,150" data-comments-opened="1" data-image-title="iPhone Android same UI" data-image-description="&lt;p&gt;iPhone Android same UI&lt;/p&gt;
" data-image-caption="&lt;p&gt;iPhone Android same interface&lt;/p&gt;
" data-large-file="https://i0.wp.com/www.truiton.com/wp-content/uploads/2013/03/post_Image.png?fit=590%2C150&amp;ssl=1" class="   wp-image-38 size-full" src="https://i0.wp.com/www.truiton.com/wp-content/uploads/2013/03/post_Image.png?resize=590%2C150" alt="iPhone Android same interface" width="590" height="150" srcset="https://i0.wp.com/www.truiton.com/wp-content/uploads/2013/03/post_Image.png?w=590&amp;ssl=1 590w, https://i0.wp.com/www.truiton.com/wp-content/uploads/2013/03/post_Image.png?resize=300%2C76&amp;ssl=1 300w" sizes="auto, (max-width: 590px) 100vw, 590px" /></a><figcaption id="caption-attachment-38" class="wp-caption-text">iPhone Android app same interface</figcaption></figure></p>
<p>If you are still unclear about things consider a case where you have an android device, and in an app you have to delete a row from a list, now if we build this functionality as in iPhone i.e. delete button appears after you swipe left, being an android user even remotely you wont be able to think of this functionality as this is not an android gesture, in Android delete option or basically an item specific options appear only when you long press on that item. Although the new Gmail app shows something like that but its not what iOS has, it still has some creativity to it (Android Style). Hope this clears my point. To sum up my suggestion would be, an app on different platforms should have same user experience but different user interface. If you agree share this with your friends and follow (like) our page</p>
<div class="saboxplugin-wrap" itemtype="http://schema.org/Person" itemscope itemprop="author">
<div class="saboxplugin-tab">
<div class="saboxplugin-gravatar"><img alt='Mohit Gupt' src='https://secure.gravatar.com/avatar/a816092ad56645d2635ccfceb9f7e9d44821c19dec126cb394c882ba574eaa04?s=100&#038;d=mm&#038;r=g' srcset='https://secure.gravatar.com/avatar/a816092ad56645d2635ccfceb9f7e9d44821c19dec126cb394c882ba574eaa04?s=200&#038;d=mm&#038;r=g 2x' class='avatar avatar-100 photo' height='100' width='100' itemprop="image"/></div>
<div class="saboxplugin-authorname"><a href="https://www.truiton.com/author/mohitgupt/" class="vcard author" rel="author"><span class="fn">Mohit Gupt</span></a></div>
<div class="saboxplugin-desc">
<div itemprop="description">
<p>Born in New Delhi, India. A software engineer by profession, an android enthusiast and mobile development evangelist. My motive here is to create a group of skilled engineers, who can build better software. Reason being programming is my passion, and also it feels good to make a device do something you want. Professionally I have worked with many software engineering and product development firms. As of now too, I am employed as a senior engineer in a leading tech company. In total I may have worked on more than 20 projects professionally, but whenever I get spare time I share my thoughts here at Truiton.</p>
</div>
</div>
<div class="saboxplugin-web "><a href="http://www.truiton.com" target="_self" >www.truiton.com</a></div>
<div class="clearfix"></div>
<div class="saboxplugin-socials "><a title="Wordpress" target="_blank" href="https://www.truiton.com/author/mohitgupt/" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-wordpress" role="img" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 512 512"><path fill="currentColor" d="M61.7 169.4l101.5 278C92.2 413 43.3 340.2 43.3 256c0-30.9 6.6-60.1 18.4-86.6zm337.9 75.9c0-26.3-9.4-44.5-17.5-58.7-10.8-17.5-20.9-32.4-20.9-49.9 0-19.6 14.8-37.8 35.7-37.8.9 0 1.8.1 2.8.2-37.9-34.7-88.3-55.9-143.7-55.9-74.3 0-139.7 38.1-177.8 95.9 5 .2 9.7.3 13.7.3 22.2 0 56.7-2.7 56.7-2.7 11.5-.7 12.8 16.2 1.4 17.5 0 0-11.5 1.3-24.3 2l77.5 230.4L249.8 247l-33.1-90.8c-11.5-.7-22.3-2-22.3-2-11.5-.7-10.1-18.2 1.3-17.5 0 0 35.1 2.7 56 2.7 22.2 0 56.7-2.7 56.7-2.7 11.5-.7 12.8 16.2 1.4 17.5 0 0-11.5 1.3-24.3 2l76.9 228.7 21.2-70.9c9-29.4 16-50.5 16-68.7zm-139.9 29.3l-63.8 185.5c19.1 5.6 39.2 8.7 60.1 8.7 24.8 0 48.5-4.3 70.6-12.1-.6-.9-1.1-1.9-1.5-2.9l-65.4-179.2zm183-120.7c.9 6.8 1.4 14 1.4 21.9 0 21.6-4 45.8-16.2 76.2l-65 187.9C426.2 403 468.7 334.5 468.7 256c0-37-9.4-71.8-26-102.1zM504 256c0 136.8-111.3 248-248 248C119.2 504 8 392.7 8 256 8 119.2 119.2 8 256 8c136.7 0 248 111.2 248 248zm-11.4 0c0-130.5-106.2-236.6-236.6-236.6C125.5 19.4 19.4 125.5 19.4 256S125.6 492.6 256 492.6c130.5 0 236.6-106.1 236.6-236.6z"></path></svg></span></a><a title="Twitter" target="_blank" href="http://twitter.com/mohitgupt" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-twitter" role="img" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 30 30"><path d="M26.37,26l-8.795-12.822l0.015,0.012L25.52,4h-2.65l-6.46,7.48L11.28,4H4.33l8.211,11.971L12.54,15.97L3.88,26h2.65 l7.182-8.322L19.42,26H26.37z M10.23,6l12.34,18h-2.1L8.12,6H10.23z" /></svg></span></a><a title="Facebook" target="_blank" href="https://www.facebook.com/Mr.Mohit.Gupt" rel="nofollow noopener" class="saboxplugin-icon-grey"><svg aria-hidden="true" class="sab-facebook" role="img" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 264 512"><path fill="currentColor" d="M76.7 512V283H0v-91h76.7v-71.7C76.7 42.4 124.3 0 193.8 0c33.3 0 61.9 2.5 70.2 3.6V85h-48.2c-37.8 0-45.1 18-45.1 44.3V192H256l-11.7 91h-73.6v229"></path></svg></span></a></div>
</div>
</div>
<p>The post <a href="https://www.truiton.com/2013/03/should-iphone-and-android-apps-have-same-interface/">Should iPhone and android apps have same interface ?</a> appeared first on <a href="https://www.truiton.com">Truiton</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.truiton.com/2013/03/should-iphone-and-android-apps-have-same-interface/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">30</post-id>	</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

Page Caching using Disk: Enhanced 
Minified using Disk

Served from: www.truiton.com @ 2026-06-28 07:21:57 by W3 Total Cache
-->