私が持っているのは、ナビゲーションドロワーを使用して作成した左側のナビゲーションサイドバーです..それは問題なく動作しますが、アクティビティの同じレイアウトでも3つのボタンがあります..メニューが表示されるたびに、3つのボタンの下に表示されますこれはとても奇妙です..私はこのメニューをアクティビティの他のすべての上に表示したいです..ここに私のxmlコードがあります:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@string/layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background"
>
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- Framelayout to display Fragments -->
<FrameLayout
android:id="@+id/frame_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- Listview to display slider menu -->
<ListView
android:id="@+id/list_slidermenu"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:divider="#ffffff"
android:dividerHeight="1dp"
android:listSelector="@drawable/list_selector"
android:background="#703534"/>
</android.support.v4.widget.DrawerLayout>
<Button
android:id="@+id/button2"
android:layout_width="170sp"
android:layout_height="60sp"
android:layout_alignLeft="@+id/button1"
android:layout_centerVertical="true"
android:background="@drawable/catalogue" />
<Button
android:id="@+id/button1"
android:layout_width="170sp"
android:layout_height="60sp"
android:layout_above="@+id/button2"
android:layout_centerHorizontal="true"
android:layout_marginBottom="52dp"
android:background="@drawable/our_products" />
<Button
android:id="@+id/button3"
android:layout_width="170sp"
android:layout_height="60sp"
android:layout_below="@+id/button2"
android:layout_centerHorizontal="true"
android:layout_marginTop="52dp"
android:background="@drawable/contact_us" />
</RelativeLayout>
誰かが私を助けることができますか?
xmlで物事を定義する方法の順序によって、それらが画面にどのように表示されるかが決まり、どのビューが他のどのビューの上または下に表示されるかも決定されます。Nav Drawerの場合、レイアウトは次のようになります。
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:font="http://schemas.android.com/apk/res/com.teewe.client"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<!-- This LinearLayout is the layout for your activity. Replace with FrameLayout -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="vertical"
android:padding="@dimen/padding_from_screen_edges" >
</LinearLayout>
<!--The last view that you include, shows up in your drawer. In this case, everything inside this RelativeLayout shows up in the drawer. -->
<RelativeLayout
android:id="@+id/drawerRelativeLayout"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#fff" >
<ListView
android:id="@+id/left_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_above="@id/nowPlayingLayout"
android:choiceMode="singleChoice"
android:divider="@color/light_gray"
android:dividerHeight="1dp" />
</RelativeLayout>
</android.support.v4.widget.DrawerLayout>
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加