I'm using custom action bar in AppCompatActivity. I give the my code below as well as the pitcher. i tried all solution available in stack over flow. But till i can't fix this issue.please assist me.
action_toolbar.xml
<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/toolbar"
style="@style/toolBarTheme"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
app:contentInsetStart="0dp"
app:theme="@style/AppTheme.AppBarOverlay">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/appLogo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/app_name"
android:src="@mipmap/ic_launcher" />
<TextView
android:id="@+id/tvToolbarTitle"
style="@style/textViewTheme"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/appLogo"
android:layout_toEndOf="@+id/appLogo"
android:layout_marginLeft="14dp"
android:layout_marginStart="14dp" />
</RelativeLayout>
you can use
toolbar
property for thislike this use in toolbar
if you are using
Toolbar
then add the following line inToolbar
inxml
Update:
You mean you want toolbar like Whatsapp. but it's not done by using App-compat Support Library Toolbar you have to use Custom Action Bar.
You can get the following result as shown in the Picture below
by using following code.
activity.xml
custom_toolbar.xml
YourActivity.java