Berikut ini kode untuk menampilkan widget AutoCompleteTextView :
package app.seamolec.autocompletetv; import android.app.Activity; import android.os.Bundle; import android.widget.ArrayAdapter; import android.widget.AutoCompleteTextView; import android.widget.LinearLayout; import android.widget.TextView; public class AutoCompleteTVActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //setContentView(R.layout.main); LinearLayout ly=new LinearLayout(this); TextView txt=new TextView(this); txt.setText("Nama tempat wisata di Jogja: "); ly.addView(txt); AutoCompleteTextView actv = new AutoCompleteTextView(this); ArrayAdapter android.R.layout.simple_dropdown_item_1line,new String[] {"Kraton","Taman Sari","Vredeburg","Parangtritis","Pasar Beringharjo"}); actv.setAdapter(aa); actv.setWidth(500); actv.setHeight(100); ly.addView(actv); setContentView(ly); } } |
Tampilan hasil AutoCompleteTextView |
0 komentar:
Posting Komentar
Ngisi comment-nya ya...
untuk sekedar tanya-tanya atau sharing...
makasih ^_^