wie bereits.
Erstellen Sie in Ihrem Projekt das neue Layout custom_toolbar.xml.
Fügen Sie den folgenden Code in der obigen Datei hinzu.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/imgLeft"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:layout_centerHorizontal="true"
android:layout_marginLeft="10dp"
android:src="@drawable/ic_events" />
<ImageView
android:id="@+id/imgRight"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentRight="true"
android:layout_centerHorizontal="true"
android:layout_marginRight="10dp"
android:src="@drawable/ic_action" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:text="Test"
android:textColor="@android:color/white"
android:textSize="25sp" />
</RelativeLayout>
Und fügen Sie dann das Layout Ihrer Symbolleiste XML-Datei.
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/ColorPrimary"
android:elevation="4dp"
android:theme="@style/ThemeOverlay.AppCompat.Dark">
<include layout="@layout/custom_toolbar" />
</android.support.v7.widget.Toolbar>
Hope this Ihnen helfen.
Verwenden Sie einfach "android.support.v7.widget.Toolbar" und passen Sie Ihre ActionBar so an. – shobhan
http://StackOverflow.com/a/12388200/3790150 – saeed
Möglicherweise müssen Sie hierfür ein benutzerdefiniertes Aktionsleisten-Layout erstellen, das Sie der Aktionsleiste als benutzerdefinierte Anzeige hinzufügen können. –