メインクラスのFragmentLayoutに問題があります。私の主な活動はマップ(Google API)であり、メニューはFragmentLayout(主なアクティビティXMLで)はwrap_content(高さ)、設定をクリックするとFragmentLayoutはショーですが、画面全体がちょうど一部で、設定の下で私は地図(そこにあるべきではない)を見る。私は私のFragmentLaoutのmatch_parentを設定すると、私の主なアクティビティからマップが表示されません。 は、ここに私のコードです。この目的のために、あなたはおそらくいうだけで(あなたのxmlが言うように)一つのメインコンテナを使用し、断片を交換したいと思いながらメインアクティビティのフラグメントコードが画面全体に表示されない
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context="com.globallogic.cityguide.MainActivity"
android:id="@+id/mainLayout"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="@layout/navigation_action"
android:layout_height="wrap_content"
android:layout_width="match_parent" />
// THIS IS MY FRAGMENTS:
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" //here is this option which cover my whole screen when i put there match_parent
android:id="@+id/main_container"
android:layout_gravity="center"
>
</FrameLayout>
<include layout="@layout/activity_outdoor_map"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<android.support.design.widget.NavigationView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:id="@+id/navigation_view"
app:menu="@menu/navigation_menu"
app:headerLayout="@layout/navigation_action"
android:layout_gravity="start"
>
</android.support.design.widget.NavigationView>
</android.support.v4.widget.DrawerLayout>
「FrameLayout」に「1」の重みを与え、高さを「0」に設定します。 – PPartisan
LinearLayoutをRelativeLayoutに置き換えます。 – zombie
私はあなたがしたくないものを手に入れません。 高さがmatch_parentに設定されている場合のコンポーネントの動作は、親ビューで使用可能なすべての領域を塗りつぶすことになります。 何かを重複させたくない場合に、layout_aboveとlayout_belowと一緒にRelativeLayoutを使用することを考慮する必要があるすべての要素の相対位置を制御したい場合は、再度質問に答えることができません。 – c0rtexx