Can i center align the application name in android
by default the application name is aligned in the left side.
so how to make it aligned it center
you have to change the theme in manifests its actually explained well in android developer website ... review this link https://developer.android.com/training/appbar/setting-up#java
you will try this in xml
android:layout_centerhorizontal="true"
you will have to create a custom theme and set the style of window title to suit your needs.
This has some guideline http://labs.makemachine.net/2010/03/custom-android-window-title/
You could also use FEATURE_CUSTOM_TITLE and set format accordingly.
This approach is detailed here.
How to change the text on the action bar
To use a custom title in your Toolbar all you need to do is remember is that Toolbar is just a fancy ViewGroup so you can add a custom title like so:
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar_top"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"
android:background="@color/action_bar_bkgnd"
app:theme="@style/ToolBarTheme" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Toolbar Title"
android:layout_gravity="center"
android:id="@+id/toolbar_title" />
</android.support.v7.widget.Toolbar>
This means that you can style the TextView however you would like because it's just a regular TextView. So in your activity you can access the title like so:
Toolbar toolbarTop = (Toolbar) findViewById(R.id.toolbar_top);
TextView mTitle = (TextView) toolbarTop.findViewById(R.id.toolbar_title);
please set your layout and textview gravity to center if it is not working then try textview layoutGravity to center