Java Code Examples for android.graphics.drawable.GradientDrawable#setAlpha()
The following examples show how to use
android.graphics.drawable.GradientDrawable#setAlpha() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RollPagerView.java From stynico with MIT License | 6 votes |
/** * 加载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); }
Example 2
Source File: BannerView.java From YCBanner with Apache License 2.0 | 6 votes |
/** * 加载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); }
Example 3
Source File: MongolToast.java From mongol-library with MIT License | 5 votes |
private GradientDrawable getShape() { GradientDrawable gradientDrawable = new GradientDrawable(); gradientDrawable.setCornerRadius(getTypedValueInDP(context, DEFAULT_CORNER_RADIUS)); gradientDrawable.setColor(DEFAULT_BACKGROUND); gradientDrawable.setAlpha(DEFAULT_ALPHA); return gradientDrawable; }
Example 4
Source File: RecentMostPlayController.java From Musicoco with Apache License 2.0 | 5 votes |
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); }
Example 5
Source File: ThemeUtil.java From NMSAlphabetAndroidApp with MIT License | 5 votes |
public static Drawable getHeaderControlDrawable(Context context){ GradientDrawable shape = new GradientDrawable(); shape.setShape(GradientDrawable.RECTANGLE); shape.setColor(getPrimaryDarkColor(context)); shape.setAlpha(254); shape.setCornerRadius(250); return shape; }
Example 6
Source File: CircleLoading.java From circleloading with Apache License 2.0 | 4 votes |
private void setUpCircleColors(ImageView circle, int color, int alpha) { GradientDrawable gradientDrawable = (GradientDrawable) circle.getDrawable(); gradientDrawable.setColor(color); gradientDrawable.setAlpha(alpha); }
Example 7
Source File: NotificationView.java From Android-Notification with Apache License 2.0 | 4 votes |
@Override public void set(GradientDrawable gd, Integer value) { gd.setAlpha(value.intValue()); }