XML布局 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:id="@+id/yourHobby" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/yourHobby" /> <Spinner android:id="@+id/hobbySpinner" android:layout_width="fill_parent" android:layout_height="wrap_content" /> </LinearLayout> string引用 <?xml version="1.0" encoding="utf-8"?> <resources> <string name="app_name">Sample_5_9</string> <string name="yourHobby">你的爱好</string> <string name="basketball">篮球</string> <string name="football">足球</string> <string name="volleyball">排球</string> </resources> 源代码 package lyh.Sample_5_9; import android.app.Activity; import android.graphics.Color; import android.os.Bundle; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.BaseAdapter; import android.widget.Spinner; import android.widget.TextView; import android.widget.AdapterView.OnItemSelectedListener; public class Sample_5_9 extends Activity { int [] hobbyIds = {R.string.football,R.string.basketball,R.string.volleyball};//足球、篮球、排球id的数组 private TextView yourHobby; private Spinner hobbySpinner; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); BaseAdapter ba = new BaseAdapter(){ @Override public int getCount() { // TODO Auto-generated method stub return hobbyIds.length; } @Override public Object getItem(int arg0) { // TODO Auto-generated method stub return null; } @Override public long getItemId(int arg0) { // TODO Auto-generated method stub return 0; } @Override public View getView(int arg0, View arg1, ViewGroup arg2) { // TODO Auto-generated method stub TextView tv = new TextView(Sample_5_9.this); tv.setText(Sample_5_9.this.getResources().getText(hobbyIds[arg0])); tv.setTextColor(Color.BLACK); return tv; } }; hobbySpinner = (Spinner)this.findViewById(R.id.hobbySpinner); hobbySpinner.setAdapter(ba); hobbySpinner.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) { // TODO Auto-generated method stub yourHobby = (TextView)findViewById(R.id.yourHobby); TextView selectTextView = (TextView)arg1; StringBuilder sb = new StringBuilder(); sb.append(Sample_5_9.this.getResources().getText(R.string.yourHobby)); sb.append(":"); sb.append(selectTextView.getText()); yourHobby.setText(sb); } @Override public void onNothingSelected(AdapterView<?> arg0) { // TODO Auto-generated method stub } }); } } 效果:选择下拉列表中的某个选项时,上面的TextView也会跟着改变