在android中,建议的文本不会显示在autoCompleteTextBox中
由于android中AutoCompleteTextBox中suggetsed文本的背景颜色和文本颜色相同,因此suggetsed文本不可见,因此我的xml文件为:在android中,建议的文本不会显示在autoCompleteTextBox中,android,android-layout,Android,Android Layout,由于android中AutoCompleteTextBox中suggetsed文本的背景颜色和文本颜色相同,因此suggetsed文本不可见,因此我的xml文件为: <AutoCompleteTextView android:id="@+id/autoCompleteTextView1" android:layout_width="0dp" android:layout_height="wrap
<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文件是:
创建时受保护的void(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(右布局、患者注册)
//获取布局中AutoCompleteTextView的引用
AutoCompleteTextView textView=(AutoCompleteTextView)findViewById(R.id.autoCompleteTextView1);
//获取字符串数组
字符串[]国家={“一月”、“芬兰”、“三月”、“六月”、“科克”、“奥波波”};
//创建适配器并将其设置为AutoCompleteTextView
ArrayAdapter=新的ArrayAdapter(此,
android.R.layout.simple_list_item_1,国家/地区);
设置阈值(1);
setAdapter(适配器);
}
尝试使用android.R.layout.simple\u下拉列表\u item\u 1line而不是android.R.layout.simple\u list\u item\u 1-这对我很有效
// 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);
}