admin
2021-05-13 4834f6ac27e483232eb0f6dae0ead378f8ea0f1a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package com.tejia.lijin.app.ui.mine;
 
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
 
import com.tejia.lijin.app.R;
 
import java.util.List;
 
/**
 * Created by weikou2015 on 2018/10/11.
 */
 
public class GoldDescFilterAdapter extends BaseAdapter {
 
    private Context mContext;
    private List<String> mList;
 
    public GoldDescFilterAdapter(Context context, List<String> list) {
        mContext = context;
        mList = list;
    }
 
    @Override
    public int getCount() {
        return mList.size() == 0 ? 0 : mList.size();
    }
 
    @Override
    public Object getItem(int position) {
        return mList.get(position);
    }
 
    @Override
    public long getItemId(int position) {
        return position;
    }
 
    @Override
    public View getView(int position, View view, ViewGroup parent) {
        view = LayoutInflater.from(mContext).inflate(R.layout.item_share_from, null);
        TextView tv_content = view.findViewById(R.id.tv_content);
        tv_content.setText(mList.get(position));
        tv_content.setCompoundDrawablesWithIntrinsicBounds(position == 0 ?
                        R.drawable.ic_gold_desc_all : position == 1 ?
                        R.drawable.ic_gold_desc_add : R.drawable.ic_gold_desc_sub,
                0, 0, 0);
 
 
        return view;
    }
}