How to determine screen position/height of SlidingDrawer handle?
HI Guys,
I'm using SlidingDrawer with a custom SurfaceView and ran into a problem. The problem is that the SurfaceView doesn't know about the remaining view area when the handle of the SlidingDrawer is being drag up and down.
Is there a way to set my SurfaceView height base on where the handle current height?
Layout XML:
<?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android开发者_JAVA百科"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<and.dev.test.CustomSurfaceView android:id="@+id/flock"
android:layout_width="fill_parent" android:layout_height="fill_parent" />
<SlidingDrawer android:layout_width="fill_parent"
android:layout_height="wrap_content" android:id="@+id/drawer"
android:handle="@+id/handle" android:content="@+id/content"
android:layout_gravity="fill">
<LinearLayout android:id="@id/handle"
android:orientation="horizontal" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:gravity="center_horizontal"
android:background="#FFFFFFFF">
<TextView android:background="@drawable/bird_blue"
android:layout_width="wrap_content" android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout android:id="@id/content"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="wrap_content">
</LinearLayout>
</SlidingDrawer> </FrameLayout>
SlidingDrawer
can only be used as an overlay over layouts. That pretty much means that you can only put it inside a FrameLayout
or a RelativeLayout
.
Just put your custom SurfaceView
and SlidingDrawer
in a FrameLayout
in your XML and you'll be fine and wont have to worry about resizing heights or anything.
Hope that helps
精彩评论