Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/rust/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
具有自定义布局的Android地图_Android_Google Maps_Android Layout_Searchbar - Fatal编程技术网

具有自定义布局的Android地图

具有自定义布局的Android地图,android,google-maps,android-layout,searchbar,Android,Google Maps,Android Layout,Searchbar,我正在努力实现这样的目标: 但是ListView与我的底部栏重叠。防止这种行为的最佳方法是什么?正如您在图片中看到的,在底部的栏下有一张地图。此底部栏类似于谷歌地图应用程序中的目标/目的地窗口 <?xml version="1.0" encoding="utf-8"?> <FrameLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:

我正在努力实现这样的目标:

但是ListView与我的底部栏重叠。防止这种行为的最佳方法是什么?正如您在图片中看到的,在底部的栏下有一张地图。此底部栏类似于谷歌地图应用程序中的目标/目的地窗口

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical">

    <com.google.android.gms.maps.MapView
        android:id="@+id/map"
        tools:layout="@layout/fragmentMap"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginLeft="2dp"
        android:layout_marginRight="2dp"
        android:layout_marginTop="2dp"
        android:orientation="vertical">

        <EditText
            android:id="@+id/mapEditT"
            android:layout_width="fill_parent"
            android:layout_height="53dp"
            android:layout_alignParentTop="true"
            android:gravity="center|left"
            android:paddingLeft="2dp"
            android:paddingRight="0dp"/>

        <ListView
            android:id="@+id/listVi"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@android:color/white"/>

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:orientation="vertical">

        <ImageButton
            android:id="@+id/draweR"
            android:layout_width="wrap_content"
            android:src="@drawable/draweR"/>

        <LinearLayout
            android:id="@+id/infoBox"
            android:layout_width="match_parent"
            android:layout_height="100dp"
            android:layout_marginTop="40dp"
            android:alpha="0.1"
            android:background="@android:color/black"
            android:orientation="horizontal">

            <TextView
                android:id="@+id/text2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginLeft="20dp"
                android:text="Info"
                />

            <TextView
                android:id="@+id/text3"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_toRightOf="@id/text2"
                android:text="Info/>

        </LinearLayout>

    </LinearLayout>

</FrameLayout>


使用
LinearLayout
RelativeLayout
作为最顶层父级,而不是
FrameLayout
。 下面是使用
LinearLayout
的代码片段

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <EditText
            android:id="@+id/textView1"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center_vertical" />

        <Button
            android:id="@+id/button1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Button" />

    </LinearLayout>

    <ListView
        android:id="@+id/listView1"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1" >
    </ListView>

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <ImageButton
            android:id="@+id/draweR"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:layout_gravity="left|center_vertical"
            android:src="@drawable/draweR"/>

        <com.google.android.gms.maps.MapView
            android:id="@+id/map"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            tools:layout="@layout/fragmentMap" />

    </FrameLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:weightSum="100" >

        <TextView
            android:id="@+id/textView2"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:text="TextView"
            android:layout_weight="75" />

        <TextView
            android:id="@+id/textView3"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:text="TextView"
            android:layout_weight="25" />

    </LinearLayout>

</LinearLayout>

你可以随意摆弄边距。我让它看起来像你想要的样子

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >

<com.google.android.gms.maps.MapView
    android:id="@+id/map"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:layout="@layout/fragmentMap" />

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginLeft="2dp"
    android:layout_marginRight="2dp"
    android:layout_marginTop="2dp"
    android:orientation="vertical"
    android:paddingBottom="160dp" >

    <EditText
        android:id="@+id/mapEditT"
        android:layout_width="fill_parent"
        android:layout_height="53dp"
        android:layout_alignParentTop="true"
        android:gravity="center|left"
        android:paddingLeft="2dp"
        android:paddingRight="0dp" />

    <ListView
        android:id="@+id/listVi"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@android:color/white" />
</LinearLayout>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom"
    android:orientation="vertical" >

    <ImageButton
        android:id="@+id/draweR"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/draweR" />

    <LinearLayout
        android:id="@+id/infoBox"
        android:layout_width="match_parent"
        android:layout_height="100dp"
        android:alpha="0.1"
        android:background="@android:color/black"
        android:orientation="horizontal" >

        <TextView
            android:id="@+id/text2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginLeft="20dp"
            android:text="Info" />

        <TextView
            android:id="@+id/text3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_toRightOf="@id/text2"
            android:text="Info" />
    </LinearLayout>
</LinearLayout>


使用
LinearLayout
RelativeLayout
作为最顶层的父级,而不是
FrameLayout