Контент под выдвижным ящиком - Android - PullRequest
0 голосов
/ 17 февраля 2012

У меня проблемы с тем, чтобы эта кнопка появлялась только под ящиком. Я использую пакет, который я нашел в Интернете, а не выдвижной ящик, который поставляется с SDK.

Вот макет main.xml:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" xmlns:ns="http://schemas.android.com/apk/res/it.sephiroth.demo.slider"> 

    <Button
        android:id="@+id/button_open"
        android:layout_width="100dp"
        android:layout_height="wrap_content"
        android:text="@string/open"
        android:layout_centerInParent="true"
        android:visibility="gone" />


    <it.sephiroth.demo.slider.widget.MultiDirectionSlidingDrawer
        xmlns:my="http://schemas.android.com/apk/res/it.sephiroth.demo.slider"
        android:id="@+id/drawer"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        ns:content="@+id/content"
        ns:direction="topToBottom"
        ns:handle="@+id/handle" >

        <include
            android:id="@id/content"
            layout="@layout/pen_content" />

        <ImageView
            android:id="@id/handle"
            android:layout_width="wrap_content"
            android:layout_height="40dp"
            android:src="@drawable/sliding_drawer_handle_bottom" />
    </it.sephiroth.demo.slider.widget.MultiDirectionSlidingDrawer>

    <LinearLayout
        android:id="@+id/frameLayout1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="120dp"
        android:layout_marginTop="133dp" >

        <Button
            android:id="@+id/button1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Button" />
    </LinearLayout>

</RelativeLayout>

И в случае, если это поможет, вот макет pen_content.xml, который включен:

    <RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_gravity="bottom"
    android:background="@drawable/pattern1"
    >

    <LinearLayout
        android:layout_alignParentBottom="true" 
        android:layout_width="fill_parent"
        android:orientation="vertical"
        android:gravity="bottom"
        android:layout_height="wrap_content">
        <LinearLayout
            android:layout_marginBottom="5dp"
            android:layout_marginTop="5dp"
            android:padding="5dp"
            android:orientation="horizontal"
            android:gravity="center_vertical"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content">
            <TextView
                android:text="@string/option1"
                android:id="@+id/textView1"
                android:minWidth="100dp"
                android:textColor="@android:color/black"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"></TextView>
            <SeekBar
                android:layout_width="fill_parent"
                android:id="@+id/bar_size"
                android:layout_height="wrap_content"></SeekBar>
        </LinearLayout>
        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="1px"
            android:background="#FF999999" />
        <LinearLayout
            android:layout_marginBottom="5dp"
            android:layout_marginTop="5dp"
            android:padding="5dp"
            android:orientation="horizontal"
            android:gravity="center_vertical"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content">
            <TextView
                android:text="@string/option2"
                android:id="@+id/textView2"
                android:minWidth="100dp"
                android:textColor="@android:color/black"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"></TextView>
            <SeekBar
                android:layout_width="fill_parent"
                android:id="@+id/bar_alpha"
                android:layout_height="wrap_content"></SeekBar>
        </LinearLayout>
        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="1px"
            android:background="#FF999999" />
        <LinearLayout
            android:layout_marginBottom="5dp"
            android:layout_marginTop="5dp"
            android:padding="5dp"
            android:orientation="horizontal"
            android:gravity="center_vertical"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content">
            <TextView
                android:text="@string/option3"
                android:id="@+id/textView3"
                android:minWidth="100dp"
                android:textColor="@android:color/black"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"></TextView>
            <SeekBar
                android:layout_width="fill_parent"
                android:id="@+id/bar_blur"
                android:layout_height="wrap_content"></SeekBar>
        </LinearLayout>

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="1px"
            android:background="#FF999999" />
        <RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content">
            <LinearLayout
                android:id="@+id/layout01"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:background="#FFEEEEEE"
                android:padding="10dp">
                <Button
                    android:id="@+id/button_close"
                    android:text="@string/close"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:minWidth="100dp"></Button>
            </LinearLayout>
            <LinearLayout
                android:layout_above="@id/layout01"
                android:layout_width="fill_parent"
                android:layout_height="1px"
                android:background="#FF999999" />
        </RelativeLayout>

    </LinearLayout>

</RelativeLayout>

Вот скриншоты того, как он действует сейчас (первый - когда слайдер открыт, второй - закрыт). Вы можете увидеть, как кнопка остается видимой, когда слайдер открыт. Я хочу, чтобы это было видно только на макете позади ящика. Спасибо!

Open State

Closed State

1 Ответ

1 голос
/ 18 февраля 2012

См. Мой ответ здесь , и это Вам очень поможет. , , ,

Обновлено

Похоже, вы используете пример, который я привел в ссылке. В любом случае вам просто нужно установить прозрачность макета slideDrawer. Просто посмотрите правильный код и установите прозрачность, и она решит вашу проблему.

Наслаждайтесь Coading. :)

...