List of usage examples for android.graphics.drawable GradientDrawable setGradientRadius
public void setGradientRadius(float gradientRadius)
From source file:com.linroid.pushapp.ui.setting.AboutActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (toolbar != null) { setSupportActionBar(toolbar);// w w w .j a v a2 s. c o m ViewCompat.setElevation(toolbar, 0); } initVersionName(); GradientDrawable drawable = (GradientDrawable) headerContainer.getBackground(); drawable.setGradientRadius(getResources().getDimensionPixelOffset(R.dimen.about_header_bg_radius)); headerContainer.setBackgroundDrawable(drawable); }
From source file:com.bilibili.magicasakura.utils.GradientDrawableUtils.java
void setGradientRadius(Context context, AttributeSet attrs, GradientDrawable drawable, int gradientType) throws XmlPullParserException { TypedArray a = obtainAttributes(context.getResources(), context.getTheme(), attrs, new int[] { android.R.attr.gradientRadius }); TypedValue value = a.peekValue(0);//from w w w . j ava 2 s . c o m if (value != null) { boolean radiusRel = value.type == TypedValue.TYPE_FRACTION; drawable.setGradientRadius(radiusRel ? value.getFraction(1.0f, 1.0f) : value.getFloat()); } else if (gradientType == GradientDrawable.RADIAL_GRADIENT) { throw new XmlPullParserException( "<gradient> tag requires 'gradientRadius' " + "attribute with radial type"); } a.recycle(); }
From source file:com.bilibili.magicasakura.utils.GradientDrawableInflateImpl.java
void setGradientRadius(Context context, AttributeSet attrs, GradientDrawable drawable, int gradientType) throws XmlPullParserException { TypedArray a = DrawableUtils.obtainAttributes(context.getResources(), context.getTheme(), attrs, new int[] { android.R.attr.gradientRadius }); TypedValue value = a.peekValue(0);/*from ww w . ja v a 2 s .c o m*/ if (value != null) { boolean radiusRel = value.type == TypedValue.TYPE_FRACTION; drawable.setGradientRadius(radiusRel ? value.getFraction(1.0f, 1.0f) : value.getFloat()); } else if (gradientType == GradientDrawable.RADIAL_GRADIENT) { throw new XmlPullParserException( "<gradient> tag requires 'gradientRadius' " + "attribute with radial type"); } a.recycle(); }