Ich empfehle wirklich Toolbar anstelle von ActionBar (ActionBarRTlize ist relativ alten Repository) zu verwenden. Mit Hilfe der Toolbar können Sie sie einfach anpassen (RTL oder was immer Sie wollen). Hier
ist ein Ausschnitt aus meiner neuen Symbolleiste, die Sie helfen können:
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/gray_lighter"
app:contentInsetEnd="0dp"
app:contentInsetLeft="0dp"
app:contentInsetRight="0dp"
app:contentInsetStart="0dp"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical">
<!--selectableItemBackgroundBorderless-->
<ImageButton
android:id="@+id/icon_toolbar_back"
style="@style/IconFont.XLarge"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:background="@drawable/selector_button_toolbar"
android:clickable="true"
android:focusable="true"
android:minWidth="56dp"
/>
<TextView
android:id="@+id/text_toolbar_title"
style="@style/Textview.Dark.MediumLarge"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginRight="48dp"
android:layout_toRightOf="@+id/icon_toolbar_back"
android:gravity="center" />
</RelativeLayout>
</android.support.v7.widget.Toolbar>
Und eine Sache zu erwähnen nicht vergessen Thema NoActionBar
zu ändern:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
Vielen Dank, aber diese Notwendigkeit API 16 und höher, funktioniert nicht in API 11 – sadegh
Das ist funktioniert. Haben Sie zur Laufzeit die Sprache gewechselt? Was meinst du mit nicht arbeiten? Ich benutze das in meinem letzten Projekt. – Amir
Fügen Sie Unterstützung RTL-Flag in Manifest hinzu und erstellen Sie auch RTL-Layout, wenn Sie mehrere Sprachen haben. – Amir