我在android XML佈局中遇到問題,我在下面的xml佈局中將自定義工具欄放在頂部,但是一些工具欄是如何與工具欄佈局下面的Linarlayout
重疊的,所以因爲無法點擊工具欄按鈕,因爲它位於另一個佈局的後面,請幫助我將它放在最前面,而不會影響XML設計的整體佈局。RelativeLayout重疊
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/root"
android:layout_width="match_parent"
android:background="@drawable/copy"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/container_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="2"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
app:contentInsetStart="0dp"
android:layout_weight="2"
style="@style/HomeToolbar">
<ImageView
android:id="@+id/content_hamburger"
style="@style/ImageView.Hamburger"
android:layout_weight="2"
android:src="@drawable/ic_menu_90" />
</android.support.v7.widget.Toolbar>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:outlineProvider="background">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1"
android:id="@+id/sec_root">
<LinearLayout
android:id="@+id/pagerc"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:weightSum="1">
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:outlineProvider="background"
android:layout_weight="1" />
<com.viewpagerindicator.CirclePageIndicator
android:id="@+id/indicator"
android:padding="10dip"
android:layout_height="wrap_content"
android:layout_width="fill_parent" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="6.5">
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_below="@id/pagerc"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:background="#40000000"
android:layout_height="wrap_content"
android:outlineProvider="background"
android:gravity="center_vertical|center_horizontal"
android:layout_weight="6.5">
<LinearLayout
android:id="@+id/fab_image_buttonl"
android:orientation="vertical"
android:layout_gravity="bottom|end|center_vertical|center_horizontal"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageButton
android:id="@+id/fab_image_button"
android:layout_width="@dimen/fab_button_diameter"
android:layout_height="@dimen/fab_button_diameter"
android:layout_gravity="bottom|end|center_vertical|center_horizontal"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:background="@drawable/fab_shape1"
android:src="@drawable/stadiumicon"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/fab_image_button2l"
android:orientation="vertical"
android:layout_gravity="bottom|end|center_vertical|center_horizontal"
android:layout_alignTop="@+id/fab_image_button3l"
android:layout_toLeftOf="@+id/fab_image_button3l"
android:layout_toStartOf="@+id/fab_image_button3l"
android:layout_width="@dimen/fab_button_diameter"
android:layout_height="@dimen/fab_button_diameter">
<ImageButton
android:id="@+id/fab_image_button2"
android:layout_width="@dimen/fab_button_diameter"
android:layout_height="@dimen/fab_button_diameter"
android:layout_gravity="bottom|end|center_vertical|center_horizontal"
android:background="@drawable/fab_shape1"
android:src="@drawable/resticon"
android:layout_alignTop="@+id/fab_image_button3"
android:layout_toLeftOf="@+id/fab_image_button3"
android:layout_toStartOf="@+id/fab_image_button3" />
</LinearLayout>
<LinearLayout
android:id="@+id/fab_image_button3l"
android:orientation="vertical"
android:layout_gravity="bottom|end|center_vertical|center_horizontal"
android:layout_alignParentBottom="true"
android:layout_toLeftOf="@+id/fab_image_button4l"
android:layout_toStartOf="@+id/fab_image_button4l"
android:layout_width="@dimen/fab_button_diameter"
android:layout_height="@dimen/fab_button_diameter">
<ImageButton
android:id="@+id/fab_image_button3"
android:layout_width="@dimen/fab_button_diameter"
android:layout_height="@dimen/fab_button_diameter"
android:layout_gravity="bottom|end|center_vertical|center_horizontal"
android:background="@drawable/fab_shape1"
android:src="@drawable/shopping"
android:layout_alignParentBottom="true"
android:layout_toLeftOf="@+id/fab_image_button4"
android:layout_toStartOf="@+id/fab_image_button4" />
</LinearLayout>
<LinearLayout
android:id="@+id/fab_image_button4l"
android:orientation="vertical"
android:layout_gravity="bottom|end|center_vertical|center_horizontal"
android:layout_alignParentBottom="true"
android:layout_alignTop="@+id/fab_image_buttonl"
android:layout_toLeftOf="@+id/fab_image_buttonl"
android:layout_toStartOf="@+id/fab_image_buttonl"
android:layout_width="@dimen/fab_button_diameter"
android:layout_height="@dimen/fab_button_diameter">
<ImageButton
android:id="@+id/fab_image_button4"
android:layout_width="@dimen/fab_button_diameter"
android:layout_height="@dimen/fab_button_diameter"
android:layout_gravity="bottom|end|center_vertical|center_horizontal"
android:background="@drawable/fab_shape1"
android:src="@drawable/cinema_hall"
android:layout_alignTop="@+id/fab_image_buttonl"
android:layout_toLeftOf="@+id/fab_image_buttonl"
android:layout_toStartOf="@+id/fab_image_buttonl" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</FrameLayout>
上面的佈局設計看起來像這樣。
任何幫助將不勝感激。 感謝您的閱讀!
剛剛刪除了工具欄的容器佈局,然後它工作,謝謝! –
很高興幫助:) –