대학 생활/Android
[Android] AutoCompleteTextView Text Color 버그
opid
2014. 11. 17. 19:31
AutoCompleteTextView 글자색 변경하기
문제점
AutoCompltetTextView 를 사용하는데 있어서 글자색이 하얀색으로 안보이고, textColor을 변경해도 적용되지 않는 문제
해결방안
res/layout 에 새로운 xml 파일을 생성하고 아래와 같이 작성한다.
<TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/text1" style="?android:attr/dropDownItemStyle" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android:padding="5dp" android:textAppearance="?android:attr/textAppearanceMediumInverse" android:textColor="#00f" />
Java 코드에서 어댑터를 추가할 때 위 레이아웃을 추가한다.
view = (AutoCompleteTextView)findViewById(R.id.text); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.my_list_item, data); view.setAdapter(adapter);
layout.xml에는 아래와 같이 작성되어 있어야 한다.
<AutoCompleteTextView android:id="@+id/text" android:layout_width="fill_parent" android:layout_height="wrap_content" android:hint="Tapez votre 1texte" android:textColor="#000" />
출처 링크