作为xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="20dp">
<Button
android:id="@+id/locationButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:minWidth="46dip"
android:onClick="getLocation"
android:text="@string/icon_map_marker" />
<AutoCompleteTextView
android:id="@+id/autocomplete_city"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:hint="@string/city_hint"
android:inputType="text"
android:layout_alignBottom="@+id/locationButton"
android:layout_alignTop="@id/locationButton"
android:layout_toLeftOf="@id/locationButton"
android:dropDownWidth="match_parent"
/>
<requestFocus />
</RelativeLayout>
如您所见
android:dropDownWidth="match_parent"
忽略相对布局的填充。任何想法如何解决这一问题?