¡@

Home 

2014/10/16 ¤W¤È 08:19:39

android Programming Glossary: mpaint

Auto-fit TextView for Android

http://stackoverflow.com/questions/16017165/auto-fit-textview-for-android

private SparseIntArray mTextCachedSizes private TextPaint mPaint private float mMaxTextSize private float mSpacingMult 1.0f private.. context attrs defStyle initialize private void initialize mPaint new TextPaint getPaint mMaxTextSize getTextSize mAvailableSpaceRect.. int onTestSize int suggestedSize RectF availableSPace mPaint.setTextSize suggestedSize String text getText .toString boolean..

Android color picker to be included in the activity

http://stackoverflow.com/questions/16363235/android-color-picker-to-be-included-in-the-activity

ColorPickerDialog.OnColorChangedListener private Paint mPaint mPaint new Paint on button click new ColorPickerDialog this.. private Paint mPaint mPaint new Paint on button click new ColorPickerDialog this this mPaint.getColor.. new Paint on button click new ColorPickerDialog this this mPaint.getColor .show ColorPicker Dialog public class ColorPickerDialog..

Android Drag/Animation of Views

http://stackoverflow.com/questions/2363666/android-drag-animation-of-views

extends View private Bitmap mImage private final Paint mPaint new Paint private final Point mSize new Point private final.. canvas.drawBitmap mCardImage position.x position.y mPaint public final void setPosition final Point position mRegion.set..

Efficient Map Overlays in Android Google Map

http://stackoverflow.com/questions/2848189/efficient-map-overlays-in-android-google-map

mapv boolean shadow super.draw canvas mapv shadow Paint mPaint new Paint mPaint.setDither true mPaint.setColor Color.RED mPaint.setStyle.. super.draw canvas mapv shadow Paint mPaint new Paint mPaint.setDither true mPaint.setColor Color.RED mPaint.setStyle Paint.Style.FILL_AND_STROKE.. mapv shadow Paint mPaint new Paint mPaint.setDither true mPaint.setColor Color.RED mPaint.setStyle Paint.Style.FILL_AND_STROKE..

Android - drawing path as overlay on MapView

http://stackoverflow.com/questions/3036139/android-drawing-path-as-overlay-on-mapview

i 1 to p.moveTo from.x from.y p.lineTo to.x to.y Paint mPaint new Paint mPaint.setStyle Style.FILL mPaint.setColor 0xFFFF0000.. from.x from.y p.lineTo to.x to.y Paint mPaint new Paint mPaint.setStyle Style.FILL mPaint.setColor 0xFFFF0000 mPaint.setAntiAlias.. to.y Paint mPaint new Paint mPaint.setStyle Style.FILL mPaint.setColor 0xFFFF0000 mPaint.setAntiAlias true canvas.drawPath..

Fast Scroll display problem with ListAdapter and SectionIndexer

http://stackoverflow.com/questions/3225092/fast-scroll-display-problem-with-listadapter-and-sectionindexer

mThumbVisible private int mVisibleItem private Paint mPaint private int mListOffset private Object mSections private String.. this mOverlayPos new RectF mScrollFade new ScrollFade mPaint new Paint mPaint.setAntiAlias true mPaint.setTextAlign Paint.Align.CENTER.. new RectF mScrollFade new ScrollFade mPaint new Paint mPaint.setAntiAlias true mPaint.setTextAlign Paint.Align.CENTER mPaint.setTextSize..

Custom ImageView with drop shadow

http://stackoverflow.com/questions/3693234/custom-imageview-with-drop-shadow

extends ImageView private Rect mRect private Paint mPaint public ShadowImageView Context context super context mRect new.. Context context super context mRect new Rect mPaint new Paint mPaint.setAntiAlias true mPaint.setShadowLayer 2f.. context super context mRect new Rect mPaint new Paint mPaint.setAntiAlias true mPaint.setShadowLayer 2f 1f 1f Color.BLACK..

Make certain area of bitmap transparent on touch

http://stackoverflow.com/questions/5368774/make-certain-area-of-bitmap-transparent-on-touch

post and have a Paint like below to make it transparent mPaint new Paint mPaint.setXfermode new PorterDuffXfermode PorterDuff.Mode.SRC.. a Paint like below to make it transparent mPaint new Paint mPaint.setXfermode new PorterDuffXfermode PorterDuff.Mode.SRC mPaint.setColor.. new PorterDuffXfermode PorterDuff.Mode.SRC mPaint.setColor Color.TRANSPARENT mPaint.setAntiAlias true public void..

Auto-fit TextView for Android

http://stackoverflow.com/questions/16017165/auto-fit-textview-for-android

RectF mTextRect new RectF private RectF mAvailableSpaceRect private SparseIntArray mTextCachedSizes private TextPaint mPaint private float mMaxTextSize private float mSpacingMult 1.0f private float mSpacingAdd 0.0f private float mMinTextSize 20.. Context context AttributeSet attrs int defStyle super context attrs defStyle initialize private void initialize mPaint new TextPaint getPaint mMaxTextSize getTextSize mAvailableSpaceRect new RectF mTextCachedSizes new SparseIntArray if mMaxLines.. @TargetApi Build.VERSION_CODES.JELLY_BEAN @Override public int onTestSize int suggestedSize RectF availableSPace mPaint.setTextSize suggestedSize String text getText .toString boolean singleline getMaxLines 1 if singleline mTextRect.bottom..

Android color picker to be included in the activity

http://stackoverflow.com/questions/16363235/android-color-picker-to-be-included-in-the-activity

public class MainActivity implements ColorPickerDialog.OnColorChangedListener private Paint mPaint mPaint new Paint on button click new ColorPickerDialog this this mPaint.getColor .show ColorPicker Dialog public class ColorPickerDialog.. public class MainActivity implements ColorPickerDialog.OnColorChangedListener private Paint mPaint mPaint new Paint on button click new ColorPickerDialog this this mPaint.getColor .show ColorPicker Dialog public class ColorPickerDialog.. private Paint mPaint mPaint new Paint on button click new ColorPickerDialog this this mPaint.getColor .show ColorPicker Dialog public class ColorPickerDialog extends Dialog public interface OnColorChangedListener..

Android Drag/Animation of Views

http://stackoverflow.com/questions/2363666/android-drag-animation-of-views

class draw it. Edit Here is an example class public class Card extends View private Bitmap mImage private final Paint mPaint new Paint private final Point mSize new Point private final Point mStartPosition new Point public Card Context context .. protected void onDraw Canvas canvas Point position getPosition canvas.drawBitmap mCardImage position.x position.y mPaint public final void setPosition final Point position mRegion.set position.x position.y position.x mSize.x position.y mSize.y..

Efficient Map Overlays in Android Google Map

http://stackoverflow.com/questions/2848189/efficient-map-overlays-in-android-google-map

public MyOverlay public void draw Canvas canvas MapView mapv boolean shadow super.draw canvas mapv shadow Paint mPaint new Paint mPaint.setDither true mPaint.setColor Color.RED mPaint.setStyle Paint.Style.FILL_AND_STROKE mPaint.setStrokeJoin.. public void draw Canvas canvas MapView mapv boolean shadow super.draw canvas mapv shadow Paint mPaint new Paint mPaint.setDither true mPaint.setColor Color.RED mPaint.setStyle Paint.Style.FILL_AND_STROKE mPaint.setStrokeJoin Paint.Join.ROUND.. Canvas canvas MapView mapv boolean shadow super.draw canvas mapv shadow Paint mPaint new Paint mPaint.setDither true mPaint.setColor Color.RED mPaint.setStyle Paint.Style.FILL_AND_STROKE mPaint.setStrokeJoin Paint.Join.ROUND mPaint.setStrokeCap..

Android - drawing path as overlay on MapView

http://stackoverflow.com/questions/3036139/android-drawing-path-as-overlay-on-mapview

geoPoints.get i from projection.toPixels geoPoints.get i 1 to p.moveTo from.x from.y p.lineTo to.x to.y Paint mPaint new Paint mPaint.setStyle Style.FILL mPaint.setColor 0xFFFF0000 mPaint.setAntiAlias true canvas.drawPath p mPaint super.draw.. i from projection.toPixels geoPoints.get i 1 to p.moveTo from.x from.y p.lineTo to.x to.y Paint mPaint new Paint mPaint.setStyle Style.FILL mPaint.setColor 0xFFFF0000 mPaint.setAntiAlias true canvas.drawPath p mPaint super.draw canvas mv shadow.. geoPoints.get i 1 to p.moveTo from.x from.y p.lineTo to.x to.y Paint mPaint new Paint mPaint.setStyle Style.FILL mPaint.setColor 0xFFFF0000 mPaint.setAntiAlias true canvas.drawPath p mPaint super.draw canvas mv shadow As you can see I make..

Fast Scroll display problem with ListAdapter and SectionIndexer

http://stackoverflow.com/questions/3225092/fast-scroll-display-problem-with-listadapter-and-sectionindexer

ListView mList private boolean mScrollCompleted private boolean mThumbVisible private int mVisibleItem private Paint mPaint private int mListOffset private Object mSections private String mSectionText private boolean mDrawOverlay private ScrollFade.. to know when the ListView is added setOnHierarchyChangeListener this mOverlayPos new RectF mScrollFade new ScrollFade mPaint new Paint mPaint.setAntiAlias true mPaint.setTextAlign Paint.Align.CENTER mPaint.setTextSize mOverlayTextSize mPaint.setColor.. ListView is added setOnHierarchyChangeListener this mOverlayPos new RectF mScrollFade new ScrollFade mPaint new Paint mPaint.setAntiAlias true mPaint.setTextAlign Paint.Align.CENTER mPaint.setTextSize mOverlayTextSize mPaint.setColor 0xFFFFFFFF..

Custom ImageView with drop shadow

http://stackoverflow.com/questions/3693234/custom-imageview-with-drop-shadow

import android.widget.ImageView public class ShadowImageView extends ImageView private Rect mRect private Paint mPaint public ShadowImageView Context context super context mRect new Rect mPaint new Paint mPaint.setAntiAlias true mPaint.setShadowLayer.. ImageView private Rect mRect private Paint mPaint public ShadowImageView Context context super context mRect new Rect mPaint new Paint mPaint.setAntiAlias true mPaint.setShadowLayer 2f 1f 1f Color.BLACK @Override protected void onDraw Canvas canvas.. Rect mRect private Paint mPaint public ShadowImageView Context context super context mRect new Rect mPaint new Paint mPaint.setAntiAlias true mPaint.setShadowLayer 2f 1f 1f Color.BLACK @Override protected void onDraw Canvas canvas Rect r mRect..

Make certain area of bitmap transparent on touch

http://stackoverflow.com/questions/5368774/make-certain-area-of-bitmap-transparent-on-touch

canvas.drawBitmap bmp2 new Matrix null I have looked into this post and have a Paint like below to make it transparent mPaint new Paint mPaint.setXfermode new PorterDuffXfermode PorterDuff.Mode.SRC mPaint.setColor Color.TRANSPARENT mPaint.setAntiAlias.. bmp2 new Matrix null I have looked into this post and have a Paint like below to make it transparent mPaint new Paint mPaint.setXfermode new PorterDuffXfermode PorterDuff.Mode.SRC mPaint.setColor Color.TRANSPARENT mPaint.setAntiAlias true public.. Paint like below to make it transparent mPaint new Paint mPaint.setXfermode new PorterDuffXfermode PorterDuff.Mode.SRC mPaint.setColor Color.TRANSPARENT mPaint.setAntiAlias true public void onDraw Canvas canvas canvas.drawCircle 40 40 30 mPaint..