本文整理汇总了Java中android.graphics.drawable.GradientDrawable.setAlpha方法的典型用法代码示例。如果您正苦于以下问题:Java GradientDrawable.setAlpha方法的具体用法?Java GradientDrawable.setAlpha怎么用?Java GradientDrawable.setAlpha使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.graphics.drawable.GradientDrawable
的用法示例。
在下文中一共展示了GradientDrawable.setAlpha方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadHintView
import android.graphics.drawable.GradientDrawable; //导入方法依赖的package包/类
/**
* 加载hintview的容器
*/
private void loadHintView()
{
addView(mHintView);
mHintView.setPadding(paddingLeft, paddingTop, paddingRight, paddingBottom);
LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
lp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
mHintView.setLayoutParams(lp);
GradientDrawable gd = new GradientDrawable();
gd.setColor(color);
gd.setAlpha(alpha);
mHintView.setBackgroundDrawable(gd);
mHintViewDelegate.initView(mAdapter == null ? 0 : mAdapter.getCount(), gravity, (HintView) mHintView);
}
示例2: loadHintView
import android.graphics.drawable.GradientDrawable; //导入方法依赖的package包/类
/**
* 加载hintView的容器
*/
private void loadHintView(){
addView(mHintView);
mHintView.setPadding(paddingLeft, paddingTop, paddingRight, paddingBottom);
LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
lp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
((View) mHintView).setLayoutParams(lp);
GradientDrawable gd = new GradientDrawable();
gd.setColor(color);
gd.setAlpha(alpha);
mHintView.setBackgroundDrawable(gd);
mHintViewDelegate.initView(mAdapter == null ? 0 : mAdapter.getCount(),
gravity, (BaseHintView) mHintView);
}
示例3: FlatToast
import android.graphics.drawable.GradientDrawable; //导入方法依赖的package包/类
public FlatToast(Context context) {
super(context);
mContext = context;
//toast text
textView = new TextView(context);
textView.setTextColor(Color.WHITE);
textView.setTextSize(17);
textView.setPadding(Utils.dip2px(context, 15), Utils.dip2px(context, 8), Utils.dip2px(context, 15), Utils.dip2px(context, 8));
//toast background
gradientDrawable = new GradientDrawable();
gradientDrawable.setColor(Color.parseColor("#212121"));
gradientDrawable.setAlpha(200);
gradientDrawable.setCornerRadius(Utils.dip2px(context, 10));
}
示例4: makeShape
import android.graphics.drawable.GradientDrawable; //导入方法依赖的package包/类
private void makeShape() {
loadShapeAttributes();
GradientDrawable gradientDrawable = (GradientDrawable) rootLayout.getBackground();
gradientDrawable.setCornerRadius(cornerRadius != -1 ? cornerRadius : R.dimen.default_corner_radius);
gradientDrawable.setStroke(strokeWidth, strokeColor);
if (backgroundColor == 0) {
gradientDrawable.setColor(ContextCompat.getColor(context, R.color.defaultBackgroundColor));
} else {
gradientDrawable.setColor(backgroundColor);
}
if (solidBackground) {
gradientDrawable.setAlpha(getResources().getInteger(R.integer.fullBackgroundAlpha));
} else {
gradientDrawable.setAlpha(getResources().getInteger(R.integer.defaultBackgroundAlpha));
}
rootLayout.setBackground(gradientDrawable);
}
示例5: getShape
import android.graphics.drawable.GradientDrawable; //导入方法依赖的package包/类
private GradientDrawable getShape() {
GradientDrawable gradientDrawable = new GradientDrawable();
gradientDrawable.setCornerRadius(getTypedValueInDP(context, DEFAULT_CORNER_RADIUS));
gradientDrawable.setColor(DEFAULT_BACKGROUND);
gradientDrawable.setAlpha(DEFAULT_ALPHA);
return gradientDrawable;
}
示例6: updateColors
import android.graphics.drawable.GradientDrawable; //导入方法依赖的package包/类
private void updateColors(@NonNull int[] colors) {
int startC = colors[0];
int endC = colors[2];
GradientDrawable drawable = new GradientDrawable(
GradientDrawable.Orientation.LEFT_RIGHT,
new int[]{startC, endC});
mContainer.setBackground(drawable);
drawable.setAlpha(170);
int colorFilter = 0;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
colorFilter = activity.getColor(R.color.main_rmp_image_filter);
} else {
colorFilter = activity.getResources().getColor(R.color.main_rmp_image_filter);
}
drawable.setColorFilter(colorFilter, PorterDuff.Mode.MULTIPLY);
mInfoContainer.setBackground(drawable);
int textC = colors[3];
int textBC = colors[0];
GradientDrawable td = new GradientDrawable();
td.setColor(textBC);
td.setCornerRadius(mArts.getHeight() / 2);
mArts.setBackground(td);
mArts.setTextColor(textC);
}