0

(自分で解決)
これを行う方法についてアドバイスが必要です。
明確にするために、左側に 2 つの slideDrawers を示す 2 つの写真を追加しました。
それらはデフォルトで重複しているため、問題をよりよく確認するために 1 つの画像を android-icon に変更しました。

参考 までに、画像の左側にある 2 つの引き出しに、
Alessandro Crugnola が作成したこの Drawer カスタム ウィジェットを使用しています。

デフォルトでは、ハンドラーは位置が中央にあることを知っており、それらを垂直に並べる方法についてアドバイスが必要です。写真が示すように、穴のスクリーンを使用する必要があります。

私は layout_weight="1" をテストし、それらを LinearLayout の中に入れましたが
、半分のサイズの引き出しができました。デフォルトのslidedrawerがこれを行うことができないことを私はかなり理解しているので、問題はどのようなハックがこれを行うかです.

これを行う方法はありますか?

pic1

pic2

(2 つの画像が重なったときにどのように見えるかを更新します。詳細は以下の説明を参照してください)

ここに画像の説明を入力 ここに画像の説明を入力 私の XML:

    <Gallery xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/imageEditGallery"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:spacing="2px"
        android:gravity="top"
        android:paddingTop="20dip"
    />
    <RelativeLayout
        android:id="@+id/InnerRelativeLayout"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true" >

        <EditText
            android:id="@+id/etx_addtext_drawtext"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:singleLine="true"
            android:text="Enter text here"
        />

    </RelativeLayout>

    <com.bulk.sprise.editimage.SlidingDrawerLeftFriends
        xmlns:my="http://schemas.android.com/apk/res/com.bulk.sprise"
        android:id="@+id/sliding_drawer_left_friends"
        my:direction="leftToRight"
        android:layout_width="280dip"
        android:layout_height="wrap_content"
        my:handle="@+id/handleLeftFriends"
        my:content="@+id/content"

        >
        <include
            android:id="@id/content"
        layout="@layout/drawer_left_friends_content_editimage" />
        <ImageView
            android:id="@id/handleLeftFriends"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/drawer_left"
            android:topOffset="10dip"
        />
    </com.bulk.sprise.editimage.SlidingDrawerLeftFriends>

    <com.bulk.sprise.editimage.SlidingDrawerLeftOptions
        xmlns:my="http://schemas.android.com/apk/res/com.bulk.sprise"
        android:id="@+id/sliding_drawer_left_options"
        my:direction="leftToRight"
        android:layout_width="280dip"
        android:layout_height="wrap_content"
        my:handle="@+id/handleLeftOptions"
        my:content="@+id/content"
        >
        <include
            android:id="@id/content"
        layout="@layout/drawer_left_options_content_editimage" />
        <ImageView
            android:id="@id/handleLeftOptions"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/icon"
            android:topOffset="40dip"

        />
    </com.bulk.sprise.editimage.SlidingDrawerLeftOptions>



    <LinearLayout android:id="@+id/linearLayout_container_SlidingDrawerRight"
        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"
        android:visibility="visible"
        >

        <com.bulk.sprise.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/drawer_right"
                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.bulk.sprise.editimage.WrappingSlidingDrawer>
    </LinearLayout>
</RelativeLayout>
4

3 に答える 3

1

スライド式ドロワーをsd1とsd2の両方と呼びましょう。これに対処するための(テストされていない)1つのアイデアは、ハンドラーのカスタムイメージを用意し、1つのスライドドロワー(sd1)を表示し、他の(sd2)を非表示にする(可視性を「gone」に設定)ことです。

次に、ビューで、sd1ハンドラーが表示されている端のすぐ隣に、sd2ハンドラー画像の画像(ボタンまたはプレーン画像)があります。これにより、UIは、引き出されるのを待っている2つのスライド式引き出しがあるように見えます。

したがって、ユーザーがsd1を引き出すと、設計どおりに機能するようになります。彼が他の画像をクリックすると、sd2が表示され、引き出されます。そうすれば、両方のスライド式引き出しを使用できます。

このアプローチの潜在的な問題は次のとおりです。1。テストされていない2.sd1ハンドラーのすぐ隣にsd2ハンドラーイメージを配置するには、カスタムビューが必要になる場合があります。3.画面サイズが異なるさまざまなデバイスでこのアプローチを処理するのは難しい場合があります。

于 2011-08-04T16:51:09.000 に答える
0

ああここで私たちは別の可能な解決策で再び行きます

LinearLayout内に2つのslidingDrawerがあり、それら
layout_weight="1"とで配置するとどうなりますかlayout_hight="0dip"

これはそれらを高さまで強制します、そして私は左側に垂直に等間隔に配置された2つの引き出しを持っています。
もちろん、それらは完全な高さではありませんが、私はそれらを使用したくないので、両方とも空のdummy_layout.xmlを持っています。

私が使いたいのは、ハンドラー画像がうまく均等に配置されていることです。

今、私は上記の質問xmlコードを取り、それも入れて
、ハンドラー画像をview.gone.something... にします。

これで、左側のsidaに4つのslidingdrawerがあります。2つは見えず、2つは見える。
これで、2つのドロワーハンドラーのメカニズムができました。これらはすべてのデバイスで正しく機能します。

私が見ているのは2つの引き出しです。
私がそれらを引っ張る場合、
後ろに隠されている私の希望する完全な高さの引き出しに引っ張る方向を変える何らかの方法がなければなりません。

ダミーの引き出しを見えなくすることもできると思いますが、いつものようにヘンデルを引っ張ってください。
そうすることdrawer.open()で、下にある実際のものでaをトリガーします。

多分私は途中です-私が間違っている場合は私を訂正してください。

フォローしていますか。

于 2011-08-04T20:35:00.200 に答える
0

自分でそれを機能させることができました。
これはテスト済みで、必要な人のために機能しています。
さまざまな画面サイズでテストしていません。

2 つのハンドラー イメージを作成します。
hdpi の場合、1 つは 58x400 で、もう 1 つは 58x132 です。
大きい方の下部にグラフィックを配置して、上部が透明になるようにします。
もう一方の画像ハンドラーは、通常のハンドラーのように見える必要があります。


大きな画像(slidingDrawer)が最初になるように、2つのslideDawerをxmlに配置するだけです。


また、GUI の変更によって大きいハンドラーの後ろに配置される場合は、小さいハンドラーで BringToFront() を実行する必要があります。

それでおしまい

于 2011-08-04T17:17:27.443 に答える