我正在努力使用我的Android布局。在列表视图下放置片段
我想创建一个线性布局,其中包含顶部的按钮,下一个列表视图,并且当显示列表视图的所有元素时,我想显示显示Google地图的片段。
这是我的Layout xml文件。在这种情况下,你只能看到片段和按钮,但不是列表视图
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:orientation="vertical"
tools:context="de.mypackage.MyActivity">
<Button
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_weight="0"
android:id="@+id/button_back"
android:text="@string/back"
/>
<ListView
android:id="@+id/list"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:layout_weight="1"/>
/>
<fragment
android:id="@+id/fragement"
android:name="de.mpackage.MapsFragment"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_weight="0"
tools:layout="@layout/fragment_maps"/>
</LinearLayout>
任何想法我如何能实现我的布局?
增加
layout_weight=1
你可以添加片段作为注脚到ListView? – raktale将标题添加到将保存按钮的列表视图中。将页脚添加到您的列表视图中,该视图将保存Google地图。 – nnn
@MichaelMeyer我尝试使用'wrapper_content'作为'ListView',并将'layout_weight = 1'放入'fragment'中。我发布了答案。希望能帮助到你。 :) – natsumiyu