0

我无法让布局为此工作。

我有一个适用于这种布局的地图视图:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"  
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/rel_layout_mapview">

 <org.osmdroid.views.MapView
      xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/mapview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:clickable="true"
     />

<ImageView android:id="@+id/drag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ss_pin"
android:visibility="gone"
 />

没问题,但是一旦我尝试在其上方进行自动完成,它就不起作用。

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

<AutoCompleteTextView android:id="@+id/autocomplete_country"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    />
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"  
 android:layout_width="fill_parent"
 android:layout_height="fill_parent"
 android:id="@+id/rel_layout_mapview">

<org.osmdroid.views.MapView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/mapview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:clickable="true"
     />

<ImageView android:id="@+id/drag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ss_pin"
android:visibility="gone"
/>

</RelativeLayout>

</LinearLayout>

有人可以指出我如何使用地图视图和上方的自动完成进行布局的正确方向。mapview 必须在它的 OWN 相对视图中,因为我有很多代码专门用于引用 mapview 的父级进行计算。

谢谢!

4

1 回答 1

0

我可以通过设置边距来解决它。

<FrameLayout   xmlns:android="http://schemas.android.com/apk/res/android"  
         android:layout_width="fill_parent"
         android:layout_height="fill_parent">
  <LinearLayout  xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="fill_parent"
         android:layout_height="50dip" >
<RelativeLayout 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" >

    <AutoCompleteTextView
        android:id="@+id/locationsearch2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="Enter zipcode or address"
        tools:context=".AutoCompleteDynamic" />

</RelativeLayout>

  </LinearLayout>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"  
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:id="@+id/rel_layout_mapview"
  android:layout_marginTop="50dip">

   <org.osmdroid.views.MapView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/mapview"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:clickable="true"
         />

<ImageView android:id="@+id/drag"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/ss_pin"
    android:visibility="gone"
  />
</RelativeLayout>

</FrameLayout>
于 2012-09-11T01:57:38.387 回答