由于android中AutoCompleteTextBox中的suggetsed文本的背景颜色和文本颜色相同,因此不能看到suggetsed文本,我的xml文件是:
<AutoCompleteTextView
android:id="@+id/autoCompleteTextView1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2.4"
android:background="#ffffff"
android:ems="10"
android:textColor="#000000" >
</AutoCompleteTextView>
我的清单文件是:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="9" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
我的java文件是: protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); 的setContentView(R.layout.patient_registration);
// Get a reference to the AutoCompleteTextView in the layout
AutoCompleteTextView textView = (AutoCompleteTextView) findViewById(R.id.autoCompleteTextView1);
// Get the string array
String[] countries = { "jan", "fbe", "mar", "june", "kokok", "opopopo" };
// Create the adapter and set it to the AutoCompleteTextView
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, countries);
textView.setThreshold(1);
textView.setAdapter(adapter);
}
答案 0 :(得分:1)
尝试使用android.R.layout.simple_dropdown_item_1line而不是android.R.layout.simple_list_item_1 - 它对我有用。