Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
390 views
in Technique[技术] by (71.8m points)

Android - Making Sliding Drawer to slide from Left-to-Right

I have implemented "Sliding Drawer" in my application using the below XML layout: (I got this example from androidpeople.com)

<LinearLayout android:id="@+id/LinearLayout01"
 android:layout_width="fill_parent" android:layout_height="fill_parent"
 xmlns:android="http://schemas.android.com/apk/res/android"
 android:background="@drawable/androidpeople">

 <SlidingDrawer 
  android:layout_width="wrap_content" 
  android:id="@+id/SlidingDrawer" 
  android:handle="@+id/slideHandleButton" 
  android:content="@+id/contentLayout" 
  android:layout_height="75dip"
  android:orientation="horizontal">

  <Button 
   android:layout_width="wrap_content" 
   android:layout_height="wrap_content" 
   android:id="@+id/slideHandleButton" 
   android:background="@drawable/closearrow">
  </Button>

  <LinearLayout 
   android:layout_width="wrap_content" 
   android:id="@+id/contentLayout" 
   android:orientation="horizontal" 
   android:gravity="center|top" 
   android:padding="10dip" 
   android:background="#C0C0C0" 
   android:layout_height="wrap_content">


   <Button android:id="@+id/Button01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Content"></Button>
   <Button android:id="@+id/Button02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Content"></Button>
   <Button android:id="@+id/Button03" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Content"></Button>

  </LinearLayout>

 </SlidingDrawer>
</LinearLayout>

but what I am wanting is to Slide the drawer from Left-to-right(Horizontal) instead of this right-to-left, how do i make slide drawer to slide from left-to-right direction?

Please share your idea/view/opinion/issue with me and catch me out of this problem.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Here is a tutorial on this: link

It seems that there is no positioning for sliding drawer, I can not find any layout attributes provided by the sdk. But like in the tutorial above you could write your own sliding drawer widget and apply layout attributes to position the slider/panel.


You can checkout https://github.com/umano/AndroidSlidingUpPanel


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...