开发者

android how can i close a SlidingDrawer that was opened manually

开发者 https://www.devze.com 2023-03-19 08:26 出处:网络
Been searching for a solution and i partially got it but still need to ask.. I use my finger to open the drawer.

Been searching for a solution and i partially got it but still need to ask..

I use my finger to open the drawer.

Through code im closing the drawer after user point on any of the icons.

the width=110 is because there are 3 icons in the drawer and i want them to stay on the right side just like the picture show below.

im using this

<translate android:fromXDelta="80%" android:toXDelta="100%" android:duration="300"/>

It kind of works but after it closes, it pops out again. why..

Also it's not good to write the width=110 in stone, but i could not come up with a better solution at this time. the text_ball, delete_ball and plus_ball are all a set of ldpi, hdpi and mdpi.

sorry if this sounds like two question. just trying to input as much info as possible for cooking the right answer.

android how can i close a SlidingDrawer that was opened manually

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

    <com.bent.solid.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"
        android:background="@null">

        <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="wrap_content"
            android:id="@+id/contentLayout2"
            android:orientation="vertical"
            android:background="@null"

            >

            <ImageButton android:id="@+id/btn_A"
                android:layout_height="60dip"
                android:layout_width="60dip"
                android:text="Button_A"
                android:background="@android:color/transparent"
                android:src="@drawable/plus_ball"
                android:onClick="btnAListener"
                android:gravity="right"
  开发者_如何学编程              android:scaleType="fitXY">
            </ImageButton>

            <ImageButton android:id="@+id/btn_B"
                android:layout_height="60dip"
                android:layout_width="60dip"
                android:layout_below="@+id/btn_A"
                android:text="Button_B"
                android:background="@android:color/transparent"
                android:src="@drawable/text_ball"
                android:gravity="right"
                android:onClick="btnBListener"
                android:scaleType="fitXY">
            </ImageButton>

            <ImageButton android:id="@+id/btn_C"
                android:layout_height="60dip"
                android:layout_width="60dip"
                android:layout_below="@+id/btn_B"
                android:text="Button_B"
                android:background="@android:color/transparent"
                android:src="@drawable/delete_ball"
                android:gravity="right"
                android:onClick="btnCListener"
                android:scaleType="fitXY">
            </ImageButton>

        </RelativeLayout>
    </com.bent.solid.editimage.WrappingSlidingDrawer>
</LinearLayout>


If I understand you correctly, your question can be greatly simplified to this:

I'm running an animation and at the end of the animation, the layout is not in its final animation state; it returns to its original state instead. How do I stop this?

In code, assuming anim is your animation variable, simply call anim.setFillAfter(true); before starting your animation.

0

精彩评论

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