Custom Spinner Adapter

后端 未结 5 1168
借酒劲吻你
借酒劲吻你 2020-11-30 07:19

I wanted to apply a custom font to my spinner. The only way i found out is that to create a custom adapter. Here is my code

    private class CustomAdapter e         


        
5条回答
  •  旧时难觅i
    2020-11-30 08:00

    this worked for me (ussing android.R.layout.simple_spinner_dropdown_item):

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        CheckedTextView checkedTextView = (CheckedTextView) super.getView(position, convertView, parent);
        checkedTextView.setText(itemList.get(position));
        return checkedTextView;
    }
    

    i think it's a better solution because you don't inflate multiple times.

提交回复
热议问题