我有一个包含一个地址,一些按钮和一个地图,我想显示在以下格式的部分滚动型:MapFragment不尊重matchparent
下面是结果我得到相反:
出于某种奇怪的原因,我不能强迫MapFragment尊重matchparent
属性,它总是原来是一个特定的默认他飞行。这里是基本的XML:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/tile_view"
android:orientation="vertical"
android:padding="10dp">
<!-- Address -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="@style/agencyAddress"/>
<!-- Map and Buttons -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:paddingTop="5dp">
<!-- Map -->
<fragment
android:id="@+id/agency_map"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_toRightOf="@+id/buttons"
android:layout_toEndOf="@+id/buttons"
class="com.google.android.gms.maps.MapFragment" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/buttons"
android:orientation="vertical">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/random_image"
android:src="@drawable/random_image"/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/random_image2"
android:src="@drawable/random_image"/>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
尝试在另一个布局包裹碎片,像LinearLayout中,然后匹配与你的RelativeLayout? – nem035 2014-09-19 20:10:09
不幸的是,既不能使用RelativeLayout也不能使用LinearLayout。 – 2014-09-19 20:16:22