package com.xscm.moduleutil.view; import android.content.Context; import android.util.AttributeSet; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.constraintlayout.widget.ConstraintLayout; import androidx.core.content.ContextCompat; import com.xscm.moduleutil.R; import org.jetbrains.annotations.NotNull; /** * 这是抢红包的自定义view */ public class CustomDialogView extends ConstraintLayout { public CustomDialogView(@NonNull @NotNull Context context) { super(context); init(); } public CustomDialogView(@NonNull @NotNull Context context, @Nullable @org.jetbrains.annotations.Nullable AttributeSet attrs) { super(context, attrs); init(); } public CustomDialogView(@NonNull @NotNull Context context, @Nullable @org.jetbrains.annotations.Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(); } public CustomDialogView(@NonNull @NotNull Context context, @Nullable @org.jetbrains.annotations.Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); init(); } private void init() { // 初始化视图 // 设置背景色 setBackground(ContextCompat.getDrawable(getContext(), R.drawable.bg_red_16_envel)); } }