1

オートコンプリート テキストビュー、追加ボタン、およびユーザーの入力時にポップアップするリスト ビューを含むアクティビティがあります。

ここに画像の説明を入力

xml で:

<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:dropDownVerticalOffset="0.2dp"
    android:hint="@string/city_hint"
    android:inputType="text"
    android:layout_alignBottom="@+id/locationButton"
    android:layout_alignTop="@id/locationButton"
    android:layout_toLeftOf="@id/locationButton"/>

問題は、オートコンプリート プロセスによって作成されたリストビューの幅が、オートコンプリート テキスト ビューと同じであることです。ただし、ボタンの幅を含めて全幅にする必要があります (画像を参照)。これを行う方法はありますか?

4

4 に答える 4

1

これらの整列を AutoCompleteTextView で locationButton で削除してから、全幅にサイズ変更してみてください。

于 2013-11-11T18:20:41.837 に答える
1

答えが見つかりました: http://developer.android.com/reference/android/widget/AutoCompleteTextView.html#attr_android:dropDownWidth

設定

android:dropDownWidth="match_parent"

オートコンプリートテキストビューで問題を解決します。

于 2013-11-11T19:26:07.503 に答える
0

別のレイアウトの下に listLiew を作成し、次のようにします。

<LinearLayout>
    android:width="fill_parent"
    android:height="fill_parent"
    android:orientation="vertical"
    <LinearLayout>
        android:orientation="horizontal"
        ...
        <AutoCompleteTextView> ... </AutoCompleteTextView>
        <Button> ... </Button>
    </LinearLayout>
    <ListView>
        ...
        android:width="fill_parent"
        android:height="fill_parent"
    </ListView>
</LinearLayout>

お役に立てれば (:

于 2013-11-11T18:20:15.447 に答える