1

右側にボタンがあり、クリックするとリストビューを左にスライドするヘッダーを含むアプリケーションを作成しています(Facebookのチャットリストと同様)

ここに画像の説明を入力してください -> ここに画像の説明を入力してください

リストビューを入れずにこのヘッダーを含めたところ、正しく機能していました。しかし今、私はこのリストビューを.xmlヘッダーのファイル内に挿入しています(ヘッダーは常にユーザーに表示され、ユーザーは表示されている任意のレイアウトでこのリストビューボタンをクリックできるため)。外観を変更せずにこのヘッダーを他のすべてのレイアウトに含め、ボタンをクリックするたびにこのリストを表示したいという問題。私はたくさんの答えを検索して見つけましたが、すべての解決策は、各ページの前のスクリーンショットで行ったのと同じものを作成することであり、複数のページに対する楽観的な解決策ではありません。

* APIレベル10に取り組んでおり、を使用せずに解決策を見つけたいと考えていますActionbar

より多くの情報が役立つかどうか教えてください、どんな助けでも本当にありがたいです。前もって感謝します。

私のxmlファイルを更新します:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:id="@+id/GeneralRelativeLayout"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:orientation="vertical">
    <RelativeLayout android:id="@+id/rel_layout"
                    android:layout_width="200dp"
                    android:layout_height="fill_parent"
                    android:background="@android:color/white" android:layout_alignParentRight="true">
        <LinearLayout android:id="@+id/fake_layout"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:orientation="vertical"
                      android:visibility="gone"></LinearLayout>
        <ListView android:id="@+id/list_view"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_gravity="right"
                  android:background="@android:color/background_dark"
                ></ListView>
    </RelativeLayout>
    <RelativeLayout android:id="@+id/rel_layout_second"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:background="@android:color/black">
        <LinearLayout android:id="@+id/lin_layout"
                      android:layout_width="fill_parent"
                      android:layout_height="wrap_content"
                      android:background="@android:color/background_light"
                      android:orientation="vertical"
                      android:layout_centerHorizontal="true" android:layout_alignParentTop="true">
            <Button android:id="@+id/button"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="slide"
                    android:layout_gravity="right|center"></Button>
        </LinearLayout>
    </RelativeLayout>
</RelativeLayout>
4

2 に答える 2

1

これが進むべき道だと思います:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" android:clickable="false">
    <LinearLayout
            android:id="@+id/thisistopbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:paddingLeft="3dp"/>
    <include here listview etc../>
</LinearLayout>

トップバーを一般的にして、すべての画面に含めることもできます。ただし、基本的な考え方は上記のxmlのようなもので、ボタンをトップバーに配置します。

于 2013-02-04T11:41:09.837 に答える
1

別の内部の同じユーザーインターフェイスで、および他のすべてのコンポーネントを使用してRelativeLayoutのを作成してみてください。ListViewandroid:visibility="gone"RelativeLayout

次に、メニューが開いているか閉じているかによって、メニューの状態に応じて表示を変更します。

于 2013-02-04T14:31:50.700 に答える