私はAndroidレイアウトに苦労しています。フラグメントをリストビューの下に配置
トップに、次にリストビューのボタンを含むリニアレイアウトを作成したいと思います。リストビューのすべての要素が表示されたら、Googleマップを表示するフラグメントを表示します。
これはレイアウト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
追加0dp
を使用してのheight
ためListView
? – raktaleリストビューにボタンを保持するヘッダーを追加します。 Googleマップを保持するリストビューにフッターを追加します。 – nnn
@MichaelMeyer 'ListView'に' wrap_content'を使ってみましたが、 'fragment'に' layout_weight = 1'を入れてみました。私は答えを掲載した。それが役に立てば幸い。 :) – natsumiyu