I found an easy way to do this. All you have to do is set the rotation to 180º for the sliding device, contents and handle. This is easier to understand with an example, so look what I did:
First I will show you my old SlidingDrawer, from the bottom up.
<SlidingDrawer xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/slidingDrawer" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:gravity="center_horizontal" android:handle="@+id/handle" android:content="@+id/content"> <ImageView android:id="@+id/handle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_launcher" /> <ImageView android:id="@+id/content" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#FF0000" android:src="@drawable/ic_launcher" /> </SlidingDrawer>
Now let's look at the changes I made by setting the rotation to 180º
<SlidingDrawer xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/slidingDrawer" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:gravity="center_horizontal" android:handle="@+id/handle" android:content="@+id/content" android:rotation="180"> <LinearLayout android:id="@+id/handle" android:layout_width="wrap_content" android:layout_height="wrap_content"> <ImageView android:id="@+id/imageView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_launcher" android:rotation="180" /> </LinearLayout> <ImageView android:id="@+id/content" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#FF0000" android:src="@drawable/ic_launcher" android:rotation="180" /> </SlidingDrawer>
Note that I also created LinearLayout to set as a descriptor and did not change its rotation, but I changed its birth. This was to prevent a small problem that I had, but everything works fine, and it's simple.
Leandroid Jun 27 '12 at 13:45 2012-06-27 13:45
source share