@@ -0,0 +1,3109 @@
+package cn.diaovision.omnicontrol.widget.adapter;%0A%0Aimport android.content.Context;%0Aimport android.view.LayoutInflater;%0Aimport android.view.View;%0Aimport android.view.ViewGroup;%0Aimport android.widget.BaseAdapter;%0Aimport android.widget.ImageView;%0Aimport android.widget.SpinnerAdapter;%0Aimport android.widget.TextView;%0A%0Aimport cn.diaovision.omnicontrol.R;%0A%0A/**%0A * Created by TaoYimin on 2017/6/7.%0A */%0A%0Apublic class AdapterForSpinner extends BaseAdapter implements SpinnerAdapter %7B%0A    private Context context;%0A    private LayoutInflater inflater;%0A    private String%5B%5D arrays;%0A    private int%5B%5D images;%0A%0A    public AdapterForSpinner(Context context, String%5B%5D arrays, int%5B%5D images) %7B%0A        this.context = context;%0A        inflater = LayoutInflater.from(context);%0A        this.arrays = arrays;%0A        this.images = images;%0A    %7D%0A%0A    @Override%0A    public int getCount() %7B%0A        return arrays.length;%0A    %7D%0A%0A    @Override%0A    public Object getItem(int position) %7B%0A        return arrays%5Bposition%5D;%0A    %7D%0A%0A    @Override%0A    public long getItemId(int position) %7B%0A        return position;%0A    %7D%0A%0A    /*%0A     * %E5%8A%A0%E8%BD%BD%E6%98%BE%E7%A4%BA%E5%B8%83%E5%B1%80%0A     */%0A    @Override%0A    public View getView(int position, View convertView, ViewGroup parent) %7B%0A        ViewHolder holder;%0A        if (convertView == null) %7B%0A            holder = new ViewHolder();%0A            convertView = inflater.inflate(R.layout.spinner_item, null);%0A            holder.textView = (TextView) convertView.findViewById(R.id.category_text);%0A            holder.imageView = (ImageView) convertView.findViewById(R.id.category_icon);%0A            holder.button = (ImageView) convertView.findViewById(R.id.button_select);%0A            convertView.setTag(holder);%0A        %7D else %7B%0A            holder = (ViewHolder) convertView.getTag();%0A        %7D%0A        holder.textView.setText(arrays%5Bposition%5D);%0A        if (images != null && images.length != 0) %7B%0A            holder.imageView.setImageResource(images%5Bposition%5D);%0A        %7D%0A        holder.button.setVisibility(View.VISIBLE);%0A        return convertView;%0A    %7D%0A%0A    /*%0A     * %E5%8A%A0%E8%BD%BD%E4%B8%8B%E6%8B%89%E5%B8%83%E5%B1%80%0A     */%0A    @Override%0A    public View getDropDownView(int position, View convertView, ViewGroup parent) %7B%0A        ViewHolder holder;%0A        if (convertView == null) %7B%0A            holder = new ViewHolder();%0A            convertView = inflater.inflate(R.layout.spinner_item, null);%0A            holder.textView = (TextView) convertView.findViewById(R.id.category_text);%0A            holder.imageView = (ImageView) convertView.findViewById(R.id.category_icon);%0A            holder.button = (ImageView) convertView.findViewById(R.id.button_select);%0A            convertView.setTag(holder);%0A        %7D else %7B%0A            holder = (ViewHolder) convertView.getTag();%0A        %7D%0A        holder.textView.setText(arrays%5Bposition%5D);%0A        if (images != null && images.length != 0) %7B%0A            holder.imageView.setImageResource(images%5Bposition%5D);%0A        %7D%0A        holder.button.setVisibility(View.INVISIBLE);%0A        return convertView;%0A    %7D%0A%0A    public static class ViewHolder %7B%0A        TextView textView;%0A        ImageView imageView;%0A        ImageView button;%0A    %7D%0A%7D%0A

add custom layout spinner adapter