0
我的工具欄顯示何時加載,但我的mapfragment覆蓋它,它不再可見。這裏是我的佈局:工具欄顯示負載,但消失
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<android.support.v7.widget.Toolbar
android:id="@+id/top_bar"
android:layout_width="match_parent"
android:layout_height="60dp"/>
<fragment
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:name="com.google.android.gms.maps.MapFragment"/>
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_alignParentBottom="true"
android:background="@color/white_80_opacity">
<ImageView
android:id="@+id/play_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_play_icon"
android:adjustViewBounds="true"
android:maxHeight="50dp" />
<ImageView
android:id="@+id/reduce_screen_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_fullscreen_exit_48dp"
android:adjustViewBounds="true"
android:maxHeight="50dp"
android:layout_gravity="right"
android:paddingRight="8dp" />
</android.support.v7.widget.Toolbar>
</RelativeLayout>
<ImageView
android:id="@+id/adview"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#708090" />
在代碼中,我設定的第一個工具欄:
Toolbar toolbar = (Toolbar) findViewById(R.id.top_bar);
toolbar.setTitle("State College");
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
任何想法?