本文整理匯總了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);
}