0
我已經實現了一個透明的工具欄作爲操作欄,並嘗試使用很多片段,它們工作正常,但是一旦我在該屏幕中使用地圖片段,地圖片段會與透明工具欄重疊。方法來保存這個問題......這畫面在地圖片段上創建透明工具欄
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/rl_trip_details">
<fragment
android:id="@+id/rt_fragment_map_sample"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<android.support.v7.widget.AppCompatButton
android:id="@+id/hire"
style="@style/CommonButtonStyle"
android:layout_width="130dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="@dimen/spacing_5"
android:text="@string/for_hire" />
<RelativeLayout
android:layout_width="40dp"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="@color/black_70_alpha"
android:gravity="center">
<ImageView
android:id="@+id/iv_gps"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="@dimen/spacing_5"
android:layout_marginTop="@dimen/spacing_5"
android:src="@drawable/ic_gps_fixed_black_24dp"
android:tint="@color/accent" />
<View
android:id="@+id/view1"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@+id/iv_gps" />
<ImageView
android:id="@+id/iv_network"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/iv_gps"
android:layout_alignStart="@+id/iv_gps"
android:layout_below="@+id/view1"
android:layout_marginBottom="@dimen/spacing_5"
android:src="@drawable/ic_network_wifi_black_24dp"
android:tint="@color/green" />
<View
android:id="@+id/view2"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@+id/iv_network" />
<ImageView
android:id="@+id/iv_driver"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/iv_gps"
android:layout_alignStart="@+id/iv_gps"
android:layout_below="@+id/view2"
android:layout_marginBottom="@dimen/spacing_5"
android:src="@drawable/ic_account_circle_black_24dp"
android:tint="@color/accent" />
<View
android:id="@+id/view3"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@+id/iv_driver" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_trip_details"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:background="@color/white">
<LinearLayout
android:id="@+id/ll_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_5"
android:orientation="horizontal"
android:weightSum="2">
<TextView
style="@style/CommonTextViewPrimaryStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_horizontal"
android:text="Travel Time"
android:textColor="@color/secondary_text"
android:textSize="@dimen/font_16" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/pinkish_grey_48" />
<TextView
android:id="@+id/textView"
style="@style/CommonTextViewPrimaryStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_horizontal"
android:text="Waiting Time"
android:textColor="@color/secondary_text"
android:textSize="@dimen/font_16" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_header_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/ll_header"
android:layout_marginBottom="@dimen/spacing_5"
android:layout_marginTop="@dimen/spacing_5"
android:orientation="horizontal"
android:weightSum="2">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="00:00:00"
android:textColor="@color/accent"
android:textSize="@dimen/font_22" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/pinkish_grey_48" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="00:00:00"
android:textColor="@color/accent"
android:textSize="@dimen/font_22" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/pinkish_grey_48" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@+id/ll_header_content"
android:background="@color/pinkish_grey_48" />
<LinearLayout
android:id="@+id/ll_header_2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/ll_header_content"
android:layout_marginTop="@dimen/spacing_5"
android:orientation="horizontal"
android:weightSum="2">
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/pinkish_grey_48" />
<TextView
android:id="@+id/textView2"
style="@style/CommonTextViewPrimaryStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_horizontal"
android:text="Distance"
android:textColor="@color/secondary_text"
android:textSize="@dimen/font_16" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/pinkish_grey_48" />
<TextView
style="@style/CommonTextViewPrimaryStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_horizontal"
android:text="Fare"
android:textColor="@color/secondary_text"
android:textSize="@dimen/font_16" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_header_2_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/ll_header_2"
android:layout_marginBottom="@dimen/spacing_5"
android:layout_marginTop="@dimen/spacing_5"
android:orientation="horizontal"
android:weightSum="2">
<RelativeLayout
android:id="@+id/rl_total_fare"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginRight="@dimen/spacing_5"
android:layout_toLeftOf="@+id/tv_total_fare_content"
android:text="₹"
android:textColor="@color/red"
android:textSize="@dimen/font_22" />
<TextView
android:id="@+id/tv_total_fare_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:text="0.00"
android:textColor="@color/accent"
android:textSize="@dimen/font_22" />
</RelativeLayout>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/pinkish_grey_48" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/tv_total_distance_content"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/spacing_5"
android:layout_toRightOf="@+id/tv_total_distance_content"
android:text="@string/kms"
android:textColor="@color/accent"
android:textSize="@dimen/font_22" />
<TextView
android:id="@+id/tv_total_distance_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0.00"
android:textColor="@color/accent"
android:textSize="@dimen/font_22" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
,這是我的基地佈局
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.redtaxi.driver.activities.RTNavigationActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<include layout="@layout/rt_content_navigation" />
發佈您的代碼? – Ironman
我已經發布了它 – raasesh
爲什麼你需要使用透明工具欄?只是隱藏它。 – Noorul