SlidingDrawer默认vertical效果为从底侧拉出。horizontal默认为从右侧拉出。而我想实现的是在左侧布局的抽屉。最后,我没能找到slidingDrawer的任何属性可以控制其变为左侧拉出。最后在一个高手的程序上做了一定的修改,实现了我想要的效果。
<SlidingDrawer
android:id="@+id/slidingdrawer"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:handle="@+id/handle"
android:content="@+id/content">
<LinearLayout
android:id="@id/handle"
android:layout_width="40dip"
android:layout_height="64dip"
android:background="#ff0000FF" />
<LinearLayout
android:id="@id/content"
android:layout_width="200dip"
android:layout_height="fill_parent"
android:background="#ff00FF00"
>
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"/>
<EditText
android:id="@+id/editText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
</SlidingDrawer>
该控件实现了从右向左拉出效果。
从左向右拉出效果,借用这个控件,写一个panel类,在这个类上实现。代码不用搞懂,只要把这个panel类导进去,学会使用就行啦。
这是界面效果,this有响应事件。