try this code
Spinner sp_state = new Spinner(this);
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
sp_state.setLayoutParams(lp);
ArrayAdapter<String> state_Adapter= new ArrayAdapter<String>(getParent(),android.R.layout.simple_spinner_item,ARRLIST_STATE){
public View getView(int position, View convertView,ViewGroup parent) {
View v = super.getView(position, convertView, parent);
((TextView) v).setTextSize(12);
((TextView) v).setTextColor(Color.WHITE);
return v;
}
};
state_Adapter.setDropDownViewResource(android.R.layout.simple _spinner_dropdown_item); sp_state.setAdapter(driver_state_Adapter);
嗨感謝您的回覆。我是android新手。我有我的自定義適配器,我覆蓋了getView()和getDropDownView()。我已經從convertView中獲取了textView的refrerence,並將其作爲參數傳遞給getView()。我將setTextSize(myDynamicSize)應用於該textView。一旦尺寸發生變化,但第二次沒有發生任何反應。希望我能說清楚一點。提前致謝。 –
如果你有問題,那麼你附加一個簡單的Listview像適配器Spinner.And可以玩這個 – Sameer