android Programming Glossary: paint.settextsize
Add text to image in android programmatically http://stackoverflow.com/questions/11100428/add-text-to-image-in-android-programmatically paint.setTypeface tf paint.setTextAlign Align.CENTER paint.setTextSize convertToPixels mContext 11 Rect textRect new Rect paint.getTextBounds.. is considered as 4 so as to appropriately fit in the text paint.setTextSize convertToPixels mContext 7 Scaling needs to be used for different..
Android 4.2 on Nexus 7: canvas.drawText() not working correctly http://stackoverflow.com/questions/13941270/android-4-2-on-nexus-7-canvas-drawtext-not-working-correctly paint.setAntiAlias true paint.setColor color some color paint.setTextSize size some size paint.setTypeface Typeface.defaultFromStyle Typeface.BOLD.. new Paint paint.setAntiAlias true paint.setColor color paint.setTextSize size paint.setTypeface Typeface.defaultFromStyle Typeface.BOLD..
Creating Custom ImageView http://stackoverflow.com/questions/1470867/creating-custom-imageview paint new Paint Paint.LINEAR_TEXT_FLAG paint.setColor 0x0 paint.setTextSize 12.0F System.out.println Drawing text canvas.drawText Hello..
Android - shadow on text? http://stackoverflow.com/questions/2486936/android-shadow-on-text and I wanted to be shadowed... paint.setColor Color.BLACK paint.setTextSize 55 paint.setFakeBoldText false paint.setShadowLayer 1 0 0 Color.BLACK..
Android Canvas.drawText http://stackoverflow.com/questions/2655402/android-canvas-drawtext paint paint.setColor android.R.color.black paint.setTextSize 20 canvas.drawText Some Text 10 25 paint The problem is the.. canvas.drawPaint paint paint.setColor Color.BLACK paint.setTextSize 20 canvas.drawText Some Text 10 25 paint and it all works fine..
How to use a custom typeface in a widget? http://stackoverflow.com/questions/4318572/how-to-use-a-custom-typeface-in-a-widget paint.setStyle Paint.Style.FILL paint.setColor Color.WHITE paint.setTextSize 65 paint.setTextAlign Align.CENTER myCanvas.drawText time 80..
Calculate text size according to width of text area http://stackoverflow.com/questions/4794484/calculate-text-size-according-to-width-of-text-area 0 paint.setTypeface Typeface.DEFAULT your preference here paint.setTextSize 25 have this the same as your text size String text Some random.. 1 boolean found_desired_size true while found_desired_size paint.setTextSize incr_text_size have this the same as your text size String text..
Auto Scale TextView Text to Fit within Bounds http://stackoverflow.com/questions/5033012/auto-scale-textview-text-to-fit-within-bounds int width float textSize Update the text paint object paint.setTextSize textSize Measure using a static layout StaticLayout layout new..
Gettextbounds in android http://stackoverflow.com/questions/5714600/gettextbounds-in-android paint.setTextAlign Align.LEFT paint.setTypeface typeface paint.setTextSize textSize paint.getTextBounds text 0 text.length bounds The reason..
Pagination in Android TextView http://stackoverflow.com/questions/6224517/pagination-in-android-textview 0 int text_width 0 paint.setTypeface Typeface.DEFAULT paint.setTextSize 12 have this the same as your text size String text Some random..
Android: measureText() Return Pixels Based on Scaled Pixels http://stackoverflow.com/questions/6232541/android-measuretext-return-pixels-based-on-scaled-pixels TextView. I tried the following Paint paint new Paint paint.setTextSize 20 paint.measureText sample text However it does not seem to.. .density final float scaledPx 20 densityMultiplier paint.setTextSize scaledPx final float size paint.measureText sample text share..
Why does BitmapFactory.decodeByteArray return null? http://stackoverflow.com/questions/6520745/why-does-bitmapfactory-decodebytearray-return-null paint.setStyle Paint.Style.FILL paint.setColor Color.RED paint.setTextSize 16 paint.setAntiAlias true paint.setTypeface Typeface.MONOSPACE..
Combine image and text to drawable http://stackoverflow.com/questions/6691818/combine-image-and-text-to-drawable Paint paint.setStyle Style.FILL paint.setColor Color.BLACK paint.setTextSize 20 Canvas canvas new Canvas bm canvas.drawText text 0 bm.getHeight..
Add text to image in android programmatically http://stackoverflow.com/questions/11100428/add-text-to-image-in-android-programmatically new Paint paint.setStyle Style.FILL paint.setColor Color.WHITE paint.setTypeface tf paint.setTextAlign Align.CENTER paint.setTextSize convertToPixels mContext 11 Rect textRect new Rect paint.getTextBounds text 0 text.length textRect Canvas canvas new Canvas.. textRect.width canvas.getWidth 4 the padding on either sides is considered as 4 so as to appropriately fit in the text paint.setTextSize convertToPixels mContext 7 Scaling needs to be used for different dpi's Calculate the positions int xPos canvas.getWidth..
Android 4.2 on Nexus 7: canvas.drawText() not working correctly http://stackoverflow.com/questions/13941270/android-4-2-on-nexus-7-canvas-drawtext-not-working-correctly canvas.drawText the Paint used to draw text is paint new Paint paint.setAntiAlias true paint.setColor color some color paint.setTextSize size some size paint.setTypeface Typeface.defaultFromStyle Typeface.BOLD paint.setTextAlign Align.CENTER In the logCat 4.2.1.. used for drawing the text. Now everything looks great. paint new Paint paint.setAntiAlias true paint.setColor color paint.setTextSize size paint.setTypeface Typeface.defaultFromStyle Typeface.BOLD paint.setTextAlign Align.CENTER paint.setLinearText true..
Creating Custom ImageView http://stackoverflow.com/questions/1470867/creating-custom-imageview canvas System.out.println Painting content Paint paint new Paint Paint.LINEAR_TEXT_FLAG paint.setColor 0x0 paint.setTextSize 12.0F System.out.println Drawing text canvas.drawText Hello World in custom view 100 100 paint @Override public boolean..
Android - shadow on text? http://stackoverflow.com/questions/2486936/android-shadow-on-text I have the following code which is applied on a bitmap and I wanted to be shadowed... paint.setColor Color.BLACK paint.setTextSize 55 paint.setFakeBoldText false paint.setShadowLayer 1 0 0 Color.BLACK This only shadows my whole view... Thankful for any..
Android Canvas.drawText http://stackoverflow.com/questions/2655402/android-canvas-drawtext Paint paint.setColor Color.WHITE paint.setStyle Style.FILL canvas.drawPaint paint paint.setColor android.R.color.black paint.setTextSize 20 canvas.drawText Some Text 10 25 paint The problem is the text doesn't show through the background what am I doing wrong..
How to use a custom typeface in a widget? http://stackoverflow.com/questions/4318572/how-to-use-a-custom-typeface-in-a-widget true paint.setSubpixelText true paint.setTypeface clock paint.setStyle Paint.Style.FILL paint.setColor Color.WHITE paint.setTextSize 65 paint.setTextAlign Align.CENTER myCanvas.drawText time 80 60 paint return myBitmap That's the part doing the font to..
Calculate text size according to width of text area http://stackoverflow.com/questions/4794484/calculate-text-size-according-to-width-of-text-area Paint Rect bounds new Rect int text_height 0 int text_width 0 paint.setTypeface Typeface.DEFAULT your preference here paint.setTextSize 25 have this the same as your text size String text Some random text paint.getTextBounds text 0 text.length bounds text_height.. int text_check_w 0 int text_check_h 0 int incr_text_size 1 boolean found_desired_size true while found_desired_size paint.setTextSize incr_text_size have this the same as your text size String text Some random text paint.getTextBounds text 0 text.length..
Auto Scale TextView Text to Fit within Bounds http://stackoverflow.com/questions/5033012/auto-scale-textview-text-to-fit-within-bounds private int getTextHeight CharSequence source TextPaint paint int width float textSize Update the text paint object paint.setTextSize textSize Measure using a static layout StaticLayout layout new StaticLayout source paint width Alignment.ALIGN_NORMAL mSpacingMult..
Gettextbounds in android http://stackoverflow.com/questions/5714600/gettextbounds-in-android Here's an example Rect bounds new Rect Paint paint new Paint paint.setTextAlign Align.LEFT paint.setTypeface typeface paint.setTextSize textSize paint.getTextBounds text 0 text.length bounds The reason why the rectangle has such exotic coordinates is because..
Pagination in Android TextView http://stackoverflow.com/questions/6224517/pagination-in-android-textview Paint paint new Paint Rect bounds new Rect int text_height 0 int text_width 0 paint.setTypeface Typeface.DEFAULT paint.setTextSize 12 have this the same as your text size String text Some random text paint.getTextBounds text 0 text.length bounds text_check_h..
Android: measureText() Return Pixels Based on Scaled Pixels http://stackoverflow.com/questions/6232541/android-measuretext-return-pixels-based-on-scaled-pixels segment that will be 20 scaled pixels when it occupies a certain TextView. I tried the following Paint paint new Paint paint.setTextSize 20 paint.measureText sample text However it does not seem to be working. I believe it is returning a width with respect..
Why does BitmapFactory.decodeByteArray return null? http://stackoverflow.com/questions/6520745/why-does-bitmapfactory-decodebytearray-return-null this way Will this create a bitmap Paint paint new Paint paint.setStyle Paint.Style.FILL paint.setColor Color.RED paint.setTextSize 16 paint.setAntiAlias true paint.setTypeface Typeface.MONOSPACE Bitmap bm Bitmap.createBitmap 16 16 Bitmap.Config.ALPHA_8..
Combine image and text to drawable http://stackoverflow.com/questions/6691818/combine-image-and-text-to-drawable .copy Bitmap.Config.ARGB_8888 true Paint paint new Paint paint.setStyle Style.FILL paint.setColor Color.BLACK paint.setTextSize 20 Canvas canvas new Canvas bm canvas.drawText text 0 bm.getHeight 2 paint return new BitmapDrawable bm To preserve density..
|