Add dither XML attribute support to Gradient and ShapeDrawable.

Change-Id: I4b60a0ba6766b7e7b176e78dc7f15f8467e2b890
This commit is contained in:
Romain Guy
2011-02-23 15:57:08 -08:00
parent 39c512b623
commit ed7894352f
3 changed files with 80 additions and 5 deletions

View File

@@ -286,7 +286,7 @@ public class ShapeDrawable extends Drawable {
protected boolean inflateTag(String name, Resources r, XmlPullParser parser,
AttributeSet attrs) {
if (name.equals("padding")) {
if ("padding".equals(name)) {
TypedArray a = r.obtainAttributes(attrs,
com.android.internal.R.styleable.ShapeDrawablePadding);
setPadding(
@@ -315,7 +315,10 @@ public class ShapeDrawable extends Drawable {
int color = mShapeState.mPaint.getColor();
color = a.getColor(com.android.internal.R.styleable.ShapeDrawable_color, color);
mShapeState.mPaint.setColor(color);
boolean dither = a.getBoolean(com.android.internal.R.styleable.ShapeDrawable_dither, false);
mShapeState.mPaint.setDither(dither);
setIntrinsicWidth((int)
a.getDimension(com.android.internal.R.styleable.ShapeDrawable_width, 0f));
setIntrinsicHeight((int)