2011-12-18 10 views

答えて

0

がgetDropDownViewとgetViewメソッドをオーバーライドし、あなたのスピナーのためのカスタムアダプタを作成します。ありがとうございます。また、2つのデータソースが必要です.1つは全長、もう1つは短いです。あなたは私の例を見ることができます

@Override 
public View getDropDownView(int position, View convertView,ViewGroup parent) { 
    View row = LayoutInflater.from(mContext).inflate(android.R.layout.simple_spinner_dropdown_item, null); 
    TextView text = (TextView) row.findViewById(android.R.id.text1); 
    text.setText(dataFull[position]); 
    return row; 
} 

@Override 
public View getView(int position, View convertView, ViewGroup parent) { 
    View row = LayoutInflater.from(mContext).inflate(android.R.layout.simple_spinner_item, null); 
    TextView text = (TextView) row.findViewById(android.R.id.text1); 
    text.setText(dataShort[position]); 
    return row; 
} 
関連する問題