Code example for TextPaint

Methods: setColorsetShadowLayersetTextSize

0
    public Context getContext() {
        return context;
    } 
 
    private TextPaint initializeDefaultTextPaint() {
        TextPaint textPaint = new TextPaint();
        textPaint.setColor( getContext().getResources().getColor( android.R.color.white ) );
        textPaint.setShadowLayer( 2.0f, 0, 2.0f, android.R.color.black );
        // http://stackoverflow.com/questions/3061930/how-to-set-unit-for-paint-settextsize 
        textPaint.setTextSize( TypedValue.applyDimension( TypedValue.COMPLEX_UNIT_DIP, DEFAULT_FONT_SIZE, getContext().getResources().getDisplayMetrics() ) );
        return textPaint;
    } 
 
    @SuppressWarnings("deprecation") 
    private void initialize() { 
        WindowManager wm = (WindowManager) context.getSystemService( Context.WINDOW_SERVICE );
        Display display = wm.getDefaultDisplay();
        if ( Build.VERSION.SDK_INT > Build.VERSION_CODES.HONEYCOMB_MR2 ) {
            Point outSize = new Point();
            display.getSize( outSize );
Experience pair programming with AI  Get Codota for Java