I have a toolbar and i want to align the text to left instead of right.
The Main.xml file code is:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<include
android:id="@+id/main_page_toolbar"
layout="@layout/app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
</include>
The code of app_bar_layout.xml is:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main_app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/grey_border_bottom"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:titleTextColor="@color/link_blue">
</android.support.v7.widget.Toolbar>
And the relevant code in Main java file is:
mToolbar = (Toolbar) findViewById(R.id.main_page_toolbar);
setSupportActionBar(mToolbar);
final String phoneLanguage = Locale.getDefault().toString();
if (phoneLanguage.equals("iw_IL"))
{
getSupportActionBar().setTitle("פוליטיקה");
}
else
{
getSupportActionBar().setTitle("Politico");
}
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/main_app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
>
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textColor="#000000"
android:text="@string/app_name"
android:gravity="right"
/>
</android.support.v7.widget.Toolbar>