¡@

Home 

2014/10/16 ¤W¤È 08:21:09

android Programming Glossary: paint

Why retrieving Google Directions for Android using KML data is not working anymore? [duplicate]

http://stackoverflow.com/questions/11745314/why-retrieving-google-directions-for-android-using-kml-data-is-not-working-anymo

final Path path Point to draw with. private final Point p Paint for path. private final Paint paint Public constructor. @param.. with. private final Point p Paint for path. private final Paint paint Public constructor. @param route Route object representing.. defaultColour path new Path p new Point paint new Paint @Override public final void draw final Canvas c final MapView..

How to make an ImageView to have rounded corners

http://stackoverflow.com/questions/2459916/how-to-make-an-imageview-to-have-rounded-corners

import android.graphics.Canvas import android.graphics.Paint import android.graphics.PorterDuffXfermode import android.graphics.Rect.. canvas new Canvas output final int color 0xff424242 final Paint paint new Paint final Rect rect new Rect 0 0 bitmap.getWidth.. output final int color 0xff424242 final Paint paint new Paint final Rect rect new Rect 0 0 bitmap.getWidth bitmap.getHeight..

How to adjust text font size to fit textview

http://stackoverflow.com/questions/2617266/how-to-adjust-text-font-size-to-fit-textview

import android.content.Context import android.graphics.Paint import android.util.AttributeSet import android.util.TypedValue.. context attrs initialise private void initialise mTestPaint new Paint mTestPaint.set this.getPaint max size defaults to.. attrs initialise private void initialise mTestPaint new Paint mTestPaint.set this.getPaint max size defaults to the initially..

How to draw a path on a map using kml file?

http://stackoverflow.com/questions/3109158/how-to-draw-a-path-on-a-map-using-kml-file

import android.graphics.Color import android.graphics.Paint import android.graphics.Point import android.graphics.RectF.. projection mapView.getProjection if shadow false Paint paint new Paint paint.setAntiAlias true Point point new Point.. mapView.getProjection if shadow false Paint paint new Paint paint.setAntiAlias true Point point new Point projection.toPixels..

How to draw a line in android

http://stackoverflow.com/questions/3616676/how-to-draw-a-line-in-android

import android.graphics.Color import android.graphics.Paint import android.view.View public class DrawView extends View.. android.view.View public class DrawView extends View Paint paint new Paint public DrawView Context context super context.. public class DrawView extends View Paint paint new Paint public DrawView Context context super context paint.setColor..

Custom ImageView with drop shadow

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

import android.graphics.Color import android.graphics.Paint import android.graphics.Rect import android.widget.ImageView.. extends ImageView private Rect mRect private Paint mPaint public ShadowImageView Context context super context.. extends ImageView private Rect mRect private Paint mPaint public ShadowImageView Context context super context mRect new..

creating a system overlay (always on top) button in android

http://stackoverflow.com/questions/4481226/creating-a-system-overlay-always-on-top-button-in-android

mView mView null class HUDView extends ViewGroup private Paint mLoadPaint public HUDView Context context super context Toast.makeText.. null class HUDView extends ViewGroup private Paint mLoadPaint public HUDView Context context super context Toast.makeText.. getContext HUDView Toast.LENGTH_LONG .show mLoadPaint new Paint mLoadPaint.setAntiAlias true mLoadPaint.setTextSize..

How can I use the animation framework inside the canvas?

http://stackoverflow.com/questions/4938822/how-can-i-use-the-animation-framework-inside-the-canvas

import android.graphics.Matrix import android.graphics.Paint import android.graphics.Rect import android.os.Bundle import.. int framesCount 0 int framesCountAvg 0 long framesTimer 0 Paint fpsPaint new Paint Frame speed long timeNow long timePrev 0.. 0 int framesCountAvg 0 long framesTimer 0 Paint fpsPaint new Paint Frame speed long timeNow long timePrev 0 long timePrevFrame..

Why retrieving Google Directions for Android using KML data is not working anymore? [duplicate]

http://stackoverflow.com/questions/11745314/why-retrieving-google-directions-for-android-using-kml-data-is-not-working-anymo

private final List GeoPoint routePoints Colour to paint routePoints. private int colour Alpha setting for route overlay... private final Point p Paint for path. private final Paint paint Public constructor. @param route Route object representing.. colour defaultColour path new Path p new Point paint new Paint @Override public final void draw final Canvas c final..

How to make an ImageView to have rounded corners

http://stackoverflow.com/questions/2459916/how-to-make-an-imageview-to-have-rounded-corners

new Canvas output final int color 0xff424242 final Paint paint new Paint final Rect rect new Rect 0 0 bitmap.getWidth bitmap.getHeight.. RectF rectF new RectF rect final float roundPx pixels paint.setAntiAlias true canvas.drawARGB 0 0 0 0 paint.setColor color.. pixels paint.setAntiAlias true canvas.drawARGB 0 0 0 0 paint.setColor color canvas.drawRoundRect rectF roundPx roundPx paint..

How to draw a path on a map using kml file?

http://stackoverflow.com/questions/3109158/how-to-draw-a-path-on-a-map-using-kml-file

projection mapView.getProjection if shadow false Paint paint new Paint paint.setAntiAlias true Point point new Point projection.toPixels.. if shadow false Paint paint new Paint paint.setAntiAlias true Point point new Point projection.toPixels.. point mode 1 #65306 start if mode 1 if defaultColor 999 paint.setColor Color.BLACK Color.BLUE else paint.setColor defaultColor..

How to draw a line in android

http://stackoverflow.com/questions/3616676/how-to-draw-a-line-in-android

android.view.View public class DrawView extends View Paint paint new Paint public DrawView Context context super context paint.setColor.. new Paint public DrawView Context context super context paint.setColor Color.BLACK @Override public void onDraw Canvas canvas.. void onDraw Canvas canvas canvas.drawLine 0 0 20 20 paint canvas.drawLine 20 0 0 20 paint The activity to start it StartDraw.java..

Auto Scale TextView Text to Fit within Bounds

http://stackoverflow.com/questions/5033012/auto-scale-textview-text-to-fit-within-bounds

else. This class uses a static layout with the text paint of the original text view to measure the height. From there.. height 0 width 0 mTextSize 0 return Get the text view's paint object TextPaint textPaint getPaint Store the current text size.. flag mNeedsResize false Set the text size of the text paint object and use a static layout to render text off screen before..

Why retrieving Google Directions for Android using KML data is not working anymore? [duplicate]

http://stackoverflow.com/questions/11745314/why-retrieving-google-directions-for-android-using-kml-data-is-not-working-anymo

private static final float STROKE 4.5f Route path. private final Path path Point to draw with. private final Point p Paint for path. private final Paint paint Public constructor. @param route Route object representing the route. @param defaultColour.. 4.5f Route path. private final Path path Point to draw with. private final Point p Paint for path. private final Paint paint Public constructor. @param route Route object representing the route. @param defaultColour default colour to draw.. int defaultColour super routePoints route.getPoints colour defaultColour path new Path p new Point paint new Paint @Override public final void draw final Canvas c final MapView mv final boolean shadow super.draw c mv shadow paint.setColor..

How to make an ImageView to have rounded corners

http://stackoverflow.com/questions/2459916/how-to-make-an-imageview-to-have-rounded-corners

package com.company.app.utils import android.graphics.Bitmap import android.graphics.Canvas import android.graphics.Paint import android.graphics.PorterDuffXfermode import android.graphics.Rect import android.graphics.RectF import android.graphics.Bitmap.Config.. bitmap.getWidth bitmap .getHeight Config.ARGB_8888 Canvas canvas new Canvas output final int color 0xff424242 final Paint paint new Paint final Rect rect new Rect 0 0 bitmap.getWidth bitmap.getHeight final RectF rectF new RectF rect final float.. bitmap .getHeight Config.ARGB_8888 Canvas canvas new Canvas output final int color 0xff424242 final Paint paint new Paint final Rect rect new Rect 0 0 bitmap.getWidth bitmap.getHeight final RectF rectF new RectF rect final float roundPx pixels..

How to adjust text font size to fit textview

http://stackoverflow.com/questions/2617266/how-to-adjust-text-font-size-to-fit-textview

It also include's gregm's bug fixes and a bug fix of my own. import android.content.Context import android.graphics.Paint import android.util.AttributeSet import android.util.TypedValue import android.widget.TextView public class FontFitTextView.. public FontFitTextView Context context AttributeSet attrs super context attrs initialise private void initialise mTestPaint new Paint mTestPaint.set this.getPaint max size defaults to the initially specified text size unless it is too small Re.. Context context AttributeSet attrs super context attrs initialise private void initialise mTestPaint new Paint mTestPaint.set this.getPaint max size defaults to the initially specified text size unless it is too small Re size the font..

How to draw a path on a map using kml file?

http://stackoverflow.com/questions/3109158/how-to-draw-a-path-on-a-map-using-kml-file

import android.graphics.Bitmap import android.graphics.Canvas import android.graphics.Color import android.graphics.Paint import android.graphics.Point import android.graphics.RectF import com.google.android.maps.GeoPoint import com.google.android.maps.MapView.. Canvas canvas MapView mapView boolean shadow long when Projection projection mapView.getProjection if shadow false Paint paint new Paint paint.setAntiAlias true Point point new Point projection.toPixels gp1 point mode 1 #65306 start if mode.. MapView mapView boolean shadow long when Projection projection mapView.getProjection if shadow false Paint paint new Paint paint.setAntiAlias true Point point new Point projection.toPixels gp1 point mode 1 #65306 start if mode 1 if defaultColor..

How to draw a line in android

http://stackoverflow.com/questions/3616676/how-to-draw-a-line-in-android

import android.content.Context import android.graphics.Canvas import android.graphics.Color import android.graphics.Paint import android.view.View public class DrawView extends View Paint paint new Paint public DrawView Context context super.. android.graphics.Color import android.graphics.Paint import android.view.View public class DrawView extends View Paint paint new Paint public DrawView Context context super context paint.setColor Color.BLACK @Override public void onDraw Canvas.. import android.graphics.Paint import android.view.View public class DrawView extends View Paint paint new Paint public DrawView Context context super context paint.setColor Color.BLACK @Override public void onDraw Canvas canvas canvas.drawLine..

Custom ImageView with drop shadow

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

import android.content.Context import android.graphics.Canvas import android.graphics.Color import android.graphics.Paint import android.graphics.Rect import android.widget.ImageView public class ShadowImageView extends ImageView private Rect.. 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.. 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..

creating a system overlay (always on top) button in android

http://stackoverflow.com/questions/4481226/creating-a-system-overlay-always-on-top-button-in-android

WindowManager getSystemService WINDOW_SERVICE .removeView mView mView null class HUDView extends ViewGroup private Paint mLoadPaint public HUDView Context context super context Toast.makeText getContext HUDView Toast.LENGTH_LONG .show mLoadPaint.. getSystemService WINDOW_SERVICE .removeView mView mView null class HUDView extends ViewGroup private Paint mLoadPaint public HUDView Context context super context Toast.makeText getContext HUDView Toast.LENGTH_LONG .show mLoadPaint new Paint.. mLoadPaint public HUDView Context context super context Toast.makeText getContext HUDView Toast.LENGTH_LONG .show mLoadPaint new Paint mLoadPaint.setAntiAlias true mLoadPaint.setTextSize 10 mLoadPaint.setARGB 255 255 0 0 @Override protected void..

How can I use the animation framework inside the canvas?

http://stackoverflow.com/questions/4938822/how-can-i-use-the-animation-framework-inside-the-canvas

android.graphics.BitmapFactory import android.graphics.Canvas import android.graphics.Matrix import android.graphics.Paint import android.graphics.Rect import android.os.Bundle import android.view.MotionEvent import android.view.SurfaceHolder.. boolean ballFingerMove Measure frames per second. long now int framesCount 0 int framesCountAvg 0 long framesTimer 0 Paint fpsPaint new Paint Frame speed long timeNow long timePrev 0 long timePrevFrame 0 long timeDelta public BallBounces Context.. ballFingerMove Measure frames per second. long now int framesCount 0 int framesCountAvg 0 long framesTimer 0 Paint fpsPaint new Paint Frame speed long timeNow long timePrev 0 long timePrevFrame 0 long timeDelta public BallBounces Context context..

Why retrieving Google Directions for Android using KML data is not working anymore? [duplicate]

http://stackoverflow.com/questions/11745314/why-retrieving-google-directions-for-android-using-kml-data-is-not-working-anymo

extends Overlay GeoPoints representing this routePoints. private final List GeoPoint routePoints Colour to paint routePoints. private int colour Alpha setting for route overlay. private static final int ALPHA 120 Stroke width. private.. 4.5f Route path. private final Path path Point to draw with. private final Point p Paint for path. private final Paint paint Public constructor. @param route Route object representing the route. @param defaultColour default colour to draw route.. route final int defaultColour super routePoints route.getPoints colour defaultColour path new Path p new Point paint new Paint @Override public final void draw final Canvas c final MapView mv final boolean shadow super.draw c mv shadow..

How to make an ImageView to have rounded corners

http://stackoverflow.com/questions/2459916/how-to-make-an-imageview-to-have-rounded-corners

bitmap .getHeight Config.ARGB_8888 Canvas canvas new Canvas output final int color 0xff424242 final Paint paint new Paint final Rect rect new Rect 0 0 bitmap.getWidth bitmap.getHeight final RectF rectF new RectF rect final float roundPx.. Rect rect new Rect 0 0 bitmap.getWidth bitmap.getHeight final RectF rectF new RectF rect final float roundPx pixels paint.setAntiAlias true canvas.drawARGB 0 0 0 0 paint.setColor color canvas.drawRoundRect rectF roundPx roundPx paint paint.setXfermode.. final RectF rectF new RectF rect final float roundPx pixels paint.setAntiAlias true canvas.drawARGB 0 0 0 0 paint.setColor color canvas.drawRoundRect rectF roundPx roundPx paint paint.setXfermode new PorterDuffXfermode Mode.SRC_IN canvas.drawBitmap..

How to draw a path on a map using kml file?

http://stackoverflow.com/questions/3109158/how-to-draw-a-path-on-a-map-using-kml-file

canvas MapView mapView boolean shadow long when Projection projection mapView.getProjection if shadow false Paint paint new Paint paint.setAntiAlias true Point point new Point projection.toPixels gp1 point mode 1 #65306 start if mode 1 if.. mapView boolean shadow long when Projection projection mapView.getProjection if shadow false Paint paint new Paint paint.setAntiAlias true Point point new Point projection.toPixels gp1 point mode 1 #65306 start if mode 1 if defaultColor 999.. true Point point new Point projection.toPixels gp1 point mode 1 #65306 start if mode 1 if defaultColor 999 paint.setColor Color.BLACK Color.BLUE else paint.setColor defaultColor RectF oval new RectF point.x mRadius point.y mRadius point.x..

How to draw a line in android

http://stackoverflow.com/questions/3616676/how-to-draw-a-line-in-android

android.graphics.Color import android.graphics.Paint import android.view.View public class DrawView extends View Paint paint new Paint public DrawView Context context super context paint.setColor Color.BLACK @Override public void onDraw Canvas canvas.. public class DrawView extends View Paint paint new Paint public DrawView Context context super context paint.setColor Color.BLACK @Override public void onDraw Canvas canvas canvas.drawLine 0 0 20 20 paint canvas.drawLine 20 0 0.. context super context paint.setColor Color.BLACK @Override public void onDraw Canvas canvas canvas.drawLine 0 0 20 20 paint canvas.drawLine 20 0 0 20 paint The activity to start it StartDraw.java import android.app.Activity import android.graphics.Color..

Auto Scale TextView Text to Fit within Bounds

http://stackoverflow.com/questions/5033012/auto-scale-textview-text-to-fit-within-bounds

post the code here and hopefully it will be useful for someone else. This class uses a static layout with the text paint of the original text view to measure the height. From there I step down by 2 font pixels and remeasure until I have a size.. dimensions or there is no text if text null text.length 0 height 0 width 0 mTextSize 0 return Get the text view's paint object TextPaint textPaint getPaint Store the current text size float oldTextSize textPaint.getTextSize If there is a max.. this oldTextSize targetTextSize Reset force resize flag mNeedsResize false Set the text size of the text paint object and use a static layout to render text off screen before measuring private int getTextHeight CharSequence source..