First add RTL support
In order to support RTL in your app, you first need to add android:supportsRtl="true"
to the <application>
element in your manifest file.
Set LTR in SlidingPanLayout
Add in SlidingPaneLayout
android:layoutDirection="ltr"
for leftandroid:layoutDirection="locale"
determinate by system
Sample: set SlidingPanelLayout in left
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.SlidingPaneLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/sliding_panel"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:layoutDirection="ltr"
tools:context=".MainActivity"
tools:showIn="@layout/app_bar_main">
<fragment
android:id="@+id/panel_left"
android:name="onePanelFragment"
android:layout_width="180dp"
android:layout_height="match_parent"
android:layout_gravity="start" />
<fragment
android:id="@+id/panel_right"
android:name="twoPanelFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="end"
android:layout_weight="1" />
</android.support.v4.widget.SlidingPaneLayout>
remember that the components inside the SliderLayout will also affect their alignment