0
我已經設置了微調器,並將spinnerMode設置爲對話框。我在程序中隨處使用自定義字體,我想知道如何設置微調器的提示以使用我的自定義字體。我到處尋找如何做到這一點,還沒有找到它。Android setPrompt自定義字體
以下是我迄今爲止如何設置我的微調器。
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
R.layout.my_spinner_style, items) {
public View getView(int position, View convertView, ViewGroup parent) {
View v = super.getView(position, convertView, parent);
Typeface tf = Typeface.createFromAsset(getAssets(), "fonts/Exo-Bold.otf");
((TextView) v).setTypeface(tf);
return v;
}
public View getDropDownView(int position, View convertView, ViewGroup parent) {
View v = super.getDropDownView(position, convertView, parent);
Typeface tf = Typeface.createFromAsset(getAssets(), "fonts/Exo-Bold.otf");
((TextView)v).setTypeface(tf);
//v.setBackgroundColor(Color.GREEN);
return v;
}
};
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
gasChoice.setPrompt("Trip Type");
gasChoice.setAdapter(adapter);