♠ Posted by Unknown in Android at 8:03 PM
import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.LinearLayout;
import android.widget.MultiAutoCompleteTextView;
import android.widget.TextView;
public class Tes2sanActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LinearLayout ly=new LinearLayout(this);
TextView txt=new TextView(this);
txt.setText("Nama kota di Indonesia : ");
ly.addView(txt);
MultiAutoCompleteTextView mactv = new MultiAutoCompleteTextView(this);
ArrayAdapter<String> aa2 = new ArrayAdapter<String>(this,
android.R.layout.simple_dropdown_item_1line,new String[] {"Cimahi", "Bandung", "Jakarta", "Surabaya", "Bali", "Semarang","Balikpapan"});
mactv.setAdapter(aa2);
mactv.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
mactv.setWidth(500);
mactv.setHeight(50);
ly.addView(mactv);
setContentView(ly);
}
}
0 komentar:
Post a Comment