kimi
2021-02-18 0ac056bb5b4c567293482286c80a1b83a467cd33
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
package com.mylhyl.circledialog.view;
 
import android.content.Context;
import android.view.View;
import android.widget.LinearLayout;
 
import com.mylhyl.circledialog.res.values.CircleColor;
 
/**
 * 分隔线,默认垂直线
 * Created by hupei on 2017/3/30.
 */
final class DividerView extends View {
    static final int DEFAULT_ORIENTATION = LinearLayout.VERTICAL;
    private int mOrientation = DEFAULT_ORIENTATION;
 
    public DividerView(Context context) {
        this(context, DEFAULT_ORIENTATION);
    }
 
    public DividerView(Context context, int orientation) {
        this(context, orientation, 1);
    }
 
    public DividerView(Context context, int orientation, int dividerHeight) {
        super(context);
        this.mOrientation = orientation;
        setBackgroundColor(CircleColor.divider);
        if (mOrientation == DEFAULT_ORIENTATION) {
            setLayoutParams(new LinearLayout.LayoutParams(dividerHeight, LinearLayout.LayoutParams.MATCH_PARENT));
        } else {
            setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, dividerHeight));
        }
    }
 
    public void setBgColor(int bgColor) {
        setBackgroundColor(bgColor);
    }
}