4

Googleマップを使ってアプリを作っています。AutoCompleteTextView を使用して場所の提案を取得しています。出力は次のとおりです。

ここに画像の説明を入力

画像からわかるように、提案ボックスの境界線が TextView に重なっています。Linear Layout 内の Textview でカスタム アイテム レイアウトを使用しています。

<?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"
    android:background="#fff"
    android:orientation="horizontal" >

    <TextView
        android:id="@+id/resultValue"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="#fff"
        android:paddingBottom="5dp"
        android:paddingLeft="5dp"
        android:paddingRight="5dp"
        android:paddingTop="5dp"
        android:textColor="#474040"
        android:textSize="15sp" />

</LinearLayout>

提案ウィンドウを下げて、提案ウィンドウの灰色がかった境界線の色を削除または変更する方法はありますか?

4

3 に答える 3

5

受け入れられた回答と同じことをしていましたが、まだ重複の問題がありました。それを修正するには、次の呼び出しを行います。

autocompleteView.setDropDownVerticalOffset(0);
于 2015-07-02T22:18:10.773 に答える
2

このようにしてみてください、android:popupBackground="#EFEEEC" // 提案ボックスに必要な境界線に応じて変更します

<AutoCompleteTextView
            android:id="@+id/autocomplete"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:background="@drawable/text_area"
            android:inputType="text|textNoSuggestions|textMultiLine"
            android:paddingLeft="10dp"
            android:popupBackground="#EFEEEC"
            android:textColor="#333333"
            android:textColorHint="#9c9c9c"
            android:textSize="18sp"
            android:completionThreshold="1" />

およびauto_textview.xml

<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:padding="12dp"
    android:textColor="#333333"
    android:layout_margin="15dp"
    android:textSize="16sp" >
</TextView>

text_area9.png

ここに画像の説明を入力

最終出力は次のようになります

ここに画像の説明を入力

これがお役に立てば幸いです。

于 2013-10-21T17:15:41.303 に答える
0

のようなカスタムドローアブルを使用します

AutoCompleteTextView txtNames= (AutoCompleteTextView)findViewById(R.id.editBox);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.drawable.customlist, restList);
txtRestNames.setAdapter(adapter);

カスタムリストを次のように追加します

    <?xml version="1.0" encoding="utf-8"?>
  <TextView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/cust_view"  
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"
    android:padding="5dip"
    android:textSize="12dp" 
    android:singleLine="false"/>

必要に応じてパラメータ/色を変更します。試してみてください....役立つことを願っています

于 2013-10-21T16:09:24.613 に答える