1

検索しましたが、結果がありません。まだ列が表示されているメニューが必要です。それをクリックすると、左右にスライドして残りのレイアウトが表示されます。さらに、私のアクティビティをスライドさせる必要があります。何か助けはありますか?私はそのようなものを探しています:

ここに画像の説明を入力

jfeinstein からのみスライド メニューを見つけましたが、スワイプすると画面も移動します。前もって感謝します。

4

1 に答える 1

4

これはおそらくあなたが必要とするものです。

例:

activity_main.xml:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <shared.ui.actionscontentview.ActionsContentView
        android:id="@+id/content"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:actions_layout="@layout/actions"
        app:actions_spacing="50dp"
        app:content_layout="@layout/content"
        app:shadow_drawable="@drawable/shadow"
        app:shadow_width="8dip"
        app:spacing="64dip"
        app:spacing_type="right_offset" />

</RelativeLayout>
  • app:actions_layout="@layout/actions"- これは左側のメニューのレイアウトです。あなたはそこにあなたが望むすべてを置くことができます
  • app:actions_spacing- dp での左側からのオフセット - これは、左側のメニューがどのくらい表示されるかを意味します
  • app:content_layout="@layout/content"・メインコンテンツのレイアウトです。そこにすべてを置くこともできます。たとえば、そこに FrameLayout を作成し、ユーザーがクリックしたメニュー項目に基づいてコードからフラグメントをアタッチできます。
  • app:spacing_type="right_offset"-app:spacing="64dip"つまり、左側のメニューを開いたときに、メイン コンテンツがどれだけ表示されるかということです。

MainActivity.java:

@Override
protected void onCreate(Bundle savedInstanceState)
{
     setContentView(R.layout.activity_main);
     mSlidingMenu = (ActionsContentView) findViewById(R.id.content);

     //this will open menu
     mSlidingMenu.showActions();

     //this will close menu
     mSlidingMenu.showContent();

}
于 2013-09-03T08:21:24.970 に答える