开发者

android why is a sublass slidingDrawer hight behaving bad?

Probably simple but i cannot figure this out.

I have a subclass of SlidingDrawer only to handle the hight correctly.

(thanks to @seydhe for the solution)

The problem is that when i open the drawer the hight is not set correctly,

It get set as soon as i lift my finger from the handle-butten.

How can i make the SlidingDrawer set the hight before i start pulling the drawer?

I have tries in various combinations to slidingDrawerRight.requestLayout(); and it works. The problem is where can i call it? I have tried in various places like

OnClickListener

OnTouchListener

OnDrawerCloseListener

but i cannot get it to work. Maybe there's a way to fix the xml to do this?

adding tree images and the xml.

As shown in开发者_高级运维 down belove picture nr:1,

I start to open the drawer and the size is irregular:

NR1: Image when being opened..

android why is a sublass slidingDrawer hight behaving bad?

NR2: Image when fully opened as soon as i let go of finger.

android why is a sublass slidingDrawer hight behaving bad?

nr3 Image when SD background is set to #eeffae and RelativLayout background is @null

android why is a sublass slidingDrawer hight behaving bad?

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:id="@+id/RelativeLayout1"
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical">

    <Gallery xmlns:android="http://schemas.android.com/apk/res/android"
             android:id="@+id/examplegallery" 
             android:layout_width="fill_parent"
             android:layout_height="wrap_content" />
   <RelativeLayout 
        android:id="@+id/InnerRelativeLayout"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true" >
    <Button 
        android:id="@+id/btn_newpen_drawtext" 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Pen"
    />      
    <EditText 
        android:id="@+id/etx_addtext_drawtext"
        android:layout_width="fill_parent"
        android:layout_toLeftOf="@+id/btn_delete_pen"
        android:layout_toRightOf="@+id/btn_newpen_drawtext"
        android:layout_height="wrap_content"
        android:singleLine="true"
        android:text="Enter text here"
    />
        <Button 
            android:id="@+id/btn_delete_pen" 
            android:layout_toLeftOf="@+id/btn_save_drawtext"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Del"
        />
        <Button 
            android:id="@+id/btn_save_drawtext" 
            android:layout_alignParentRight="true" 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="save"
        />

    </RelativeLayout>

<LinearLayout android:id="@+id/linearLayoutSlidingDrawerRight"
              android:layout_width="150dip"
              android:layout_height="wrap_content"
              xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_alignParentRight="true"
              android:layout_centerVertical="true"
              >

    <com.bollen.sppik.editimage.WrappingSlidingDrawer android:id="@+id/slidingDrawerRight" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:handle="@+id/slideHandleButtonRight" 
        android:content="@+id/contentLayout2" 
        android:orientation="horizontal">

        <ImageButton android:id="@+id/slideHandleButtonRight"
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content" 
            android:background="@drawable/icon"
            android:onClick="btnSlidingDrawerHandler">
        </ImageButton>

        <RelativeLayout 
            android:layout_width="wrap_content" 
            android:layout_height="fill_parent"
            android:id="@+id/contentLayout2" 
            android:orientation="vertical" 
            android:background="#C0C0C0" 
            >

            <ImageButton android:id="@+id/btn_A" 
                android:layout_height="wrap_content" 
                android:layout_width="wrap_content" 
                android:text="Button_A" 
                android:background="@android:color/transparent" 
                android:src="@drawable/right_drawer"
                android:onClick="btnAListener">
            </ImageButton>

            <ImageButton android:id="@+id/btn_B" 
                android:layout_height="wrap_content" 
                android:layout_width="wrap_content" 
                android:layout_below="@+id/btn_A"
                android:text="Button_B" 
                android:background="@android:color/transparent" 
                android:src="@drawable/right_drawer"

                android:onClick="btnBListener">
            </ImageButton>          

        </RelativeLayout>
    </com.bollen.sppik.editimage.WrappingSlidingDrawer>
</LinearLayout>
</RelativeLayout>


answering my own question.
I set the background to transparent like this

android:background="@null" 

Looks ok and the odd resizing behavior still happens but it's not visible.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜