この質問がこのサイトで何度か行われているのを見たことがありますが、誰も答えを得ることができませんでした。
AndroidでAutocompleteTextviewを使用するときに表示されるドロップダウンの仕切りの外観をカスタマイズする方法はありますか?
ListView の場合は非常に簡単ですが、autocompletetextview に ArrayAdapter のみを使用すると、仕切りをカスタマイズする方法はありません。
(テキストビューではありません。私はすでにそれを知っています)
この質問がこのサイトで何度か行われているのを見たことがありますが、誰も答えを得ることができませんでした。
AndroidでAutocompleteTextviewを使用するときに表示されるドロップダウンの仕切りの外観をカスタマイズする方法はありますか?
ListView の場合は非常に簡単ですが、autocompletetextview に ArrayAdapter のみを使用すると、仕切りをカスタマイズする方法はありません。
(テキストビューではありません。私はすでにそれを知っています)
単一の AutoCompleteTextView に対してどのようにできるかわかりませんが、アプリケーション全体に設定する方法は知っています。これもあなたを助けるはずです:)
<style name="MyTheme" parent="AppTheme">
<item name="android:dropDownListViewStyle">@style/MyListViewStyle</item>
</style>
<style name="MyListViewStyle" parent="@android:style/Widget.ListView">
<item name="android:divider">#F00</item>
<item name="android:dividerHeight">1px</item>
</style>
仕切りのプロパティが見つからなかったので、これを行いました
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Medium Text"
android:id="@+id/textView129"
android:textColor="#000000"
android:background="@color/white"
android:layout_marginBottom="1dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="5dp"
android:paddingBottom="5dp"/>
</LinearLayout>
それで、私はリニアレイアウトの背景色とテキストビューの別の背景色を持っています(テキストビューの背景色はリニアレイアウトの背景色に重なっています)今、マージンプロパティを使用し、テキストビューの下マージンを1dpに設定しています要素間のきれいな線を取得します....
私は同じ問題に直面し、多くの方法を試しましたが、結果が得られませんでした。ついに、AutocompleteTextview で分割線と分割線の長さをすばやく簡単に設定できるようになりました。基本的にはArrayAdapter LayoutのTextViewで下側からボーダーを設定できます。のように
ステップ1。次のようにarrayadapetrのレイアウトを作成します
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/testt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/background_single_line"
android:textColor="@drawable/text_color"
android:textAppearance="?android:attr/textAppearanceMediumInverse"
style="?android:attr/dropDownItemStyle"
android:maxLines="1"
android:padding="3dp"
android:textSize="16sp" />
step2: drawable フォルダーに新しいレイアウトを作成し、その名前は background_single_line.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@android:color/black" />
</shape>
</item>
<item android:bottom="1dp">
<shape android:shape="rectangle">
<solid android:color="@android:color/white" />
</shape>
</item>
最後にディバイダーとして見えます。