admin
2021-06-11 ae4dc86b64bd8ef85bc832106741fb98e8d516da
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
package com.tejia.lijin.app.util.ui;
 
import android.graphics.Color;
import android.graphics.drawable.GradientDrawable;
import android.widget.TextView;
 
import com.app.hubert.guide.util.ScreenUtils;
import com.wpc.library.util.common.DimenUtils;
 
public class VIPUIUtil {
 
    public static void setGoodsDetialUserLevelIcon(TextView tv, int level) {
        //动态改变shape
        GradientDrawable shape = new GradientDrawable();
        int redius = DimenUtils.dip2px(tv.getContext(), 8);
        shape.setCornerRadii(new float[]{redius, redius, 0, 0, redius, redius, 0, 0});
        shape.setOrientation(GradientDrawable.Orientation.BR_TL);
        switch (level) {
            case 0:
                tv.setTextColor(Color.parseColor("#BE4C00"));
                shape.setColors(new int[]{Color.parseColor("#FFD783")});
                break;
            case 1:
                tv.setTextColor(Color.parseColor("#FFD6DC"));
                shape.setColors(new int[]{Color.parseColor("#C3BC51"), Color.parseColor("#FBBF68"), Color.parseColor("#D4B57F")});
                break;
            case 2:
                tv.setTextColor(Color.parseColor("#949494"));
                shape.setColors(new int[]{Color.parseColor("#DFDFDF"), Color.parseColor("#F6F6F6"), Color.parseColor("#DFDFDF")});
                break;
            case 3:
                tv.setTextColor(Color.parseColor("#FFD6DC"));
                shape.setColors(new int[]{Color.parseColor("#C3F3FF"), Color.parseColor("#F6F6F6"), Color.parseColor("#FFD1D8")});
                break;
        }
    }
 
}