sadegh sadegh - 3 months ago 25
Android Question

RTL ActionBar with Min-SDK 11

I create

DrawerLayout
and
Min-Sdk
is 11(Also Can't change
Min-Sdk
). I need change
ActionBar
to RTL and change the menu Icon. All solution I found need
Min-Sdk
17. Is there any way to do this?

enter image description here

Can I use ActionBarRTLizer in Eclipse project and ActionBarRTLizer work in
Sdk-11
?

how import ActionBarRTLizer in project?

Answer

I really recommend to use Toolbar instead of ActionBar (ActionBarRTlize is relatively old repository). By using Toolbar you can easily customize it (RTL or what ever your want).

Here is a snippet of my recent toolbar may help you:

 <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>

And one thing to mention don't forget to change theme to NoActionBar:

  <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>
Comments