달력

5

« 2024/5 »

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
728x90
반응형

안드로이드 - autocompletetextview 커스텀마이징

Add this in your xml file

<AutoCompleteTextView  
android:id="@+id/name"
android:layout_width="300dp"
android:layout_height="100dp"
android:layout_gravity="center_horizontal"
android:textSize="20dp"
android:gravity="center"
android:layout_marginBottom="10dp"
android:textColorHint="#D20B2C"/>

In your Activity.java file

   AutoCompleteTextView drpText =   (AutoCompleteTextView) this.findViewById(R.id.name); 
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.auto_list_item, UserArr);
drpText
.setAdapter(adapter);
//UserArr===> is the array of names which you want to display in AutoCompleteTextView

xml for auto_list_item

<?xml version="1.0" encoding="utf-8"?> 
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dp"
android:textSize="16sp"
android:background="@android:color/transparent"
android:textColor="#000">
</TextView>
728x90
반응형
:
Posted by mapagilove