ToastStyle.java
1.31 KB
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
package com.studymachine.www.other;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.util.TypedValue;
import com.studymachine.www.R;
import com.hjq.toast.style.BlackToastStyle;
/**
* time : 2021/02/27
* desc : Toast 样式配置
*/
public final class ToastStyle extends BlackToastStyle {
@Override
protected Drawable getBackgroundDrawable(Context context) {
// GradientDrawable drawable = new GradientDrawable();
// // 设置颜色
// drawable.setColor(0X88000000);
// // 设置圆角
// drawable.setCornerRadius(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, (int) context.getResources().getDimension(R.dimen.button_circle_size), context.getResources().getDisplayMetrics()));
return context.getDrawable(R.drawable.common_tips);
}
@Override
protected float getTextSize(Context context) {
return context.getResources().getDimension(R.dimen.sp_10);
}
@Override
protected int getHorizontalPadding(Context context) {
return (int) context.getResources().getDimension(R.dimen.sp_24);
}
@Override
protected int getVerticalPadding(Context context) {
return (int) context.getResources().getDimension(R.dimen.sp_16);
}
}