Android DynamicLayout - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android DynamicLayout class.

This code example shows how to use the following methods:draw, getLineBaseline, getWidth
		TextPaint sm = new TextPaint(Paint.ANTI_ALIAS_FLAG|Paint.SUBPIXEL_TEXT_FLAG|Paint.DEV_KERN_TEXT_FLAG);
		sm.setTypeface(Typeface.DEFAULT_BOLD);
		sm.setTextSize(getWidth() / 5.5f);
		sm.setColor(Color.WHITE);
		//sm.setShadowLayer(10.f, 7, 7, Color.BLACK); 
		DynamicLayout dl = new DynamicLayout("Sharemore", sm, getWidth(), Alignment.ALIGN_NORMAL, 0.f, 0.f, true);
		 
		 
		 
		Paint pm = new Paint(Paint.ANTI_ALIAS_FLAG|Paint.DITHER_FLAG);
		Paint lightGray = new Paint(pm);
		lightGray.setColor(Color.argb(0xff, 0xcc, 0xcc, 0xcc));
		lightGray.setStyle(Style.STROKE);
		 
		 
		 
		Rect r = new Rect(10,10,dl.getWidth()-10,getHeight()-10);
		pm.setColor(Color.argb(0xcc, 0xff, 0xff, 0xff));
		canvas.drawRect(r, pm );
		canvas.drawRect(r, lightGray);

6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:draw, getLineBaseline, getWidth
		TextPaint sm = new TextPaint(Paint.ANTI_ALIAS_FLAG|Paint.SUBPIXEL_TEXT_FLAG|Paint.DEV_KERN_TEXT_FLAG);
		sm.setTypeface(Typeface.DEFAULT_BOLD);
		sm.setTextSize(getWidth() / 5.5f);
		sm.setColor(Color.WHITE);
		//sm.setShadowLayer(10.f, 7, 7, Color.BLACK); 
		DynamicLayout dl = new DynamicLayout("Sharemore", sm, getWidth(), Alignment.ALIGN_NORMAL, 0.f, 0.f, true);
		 
		 
		 
		Paint pm = new Paint(Paint.ANTI_ALIAS_FLAG|Paint.DITHER_FLAG);
		Paint lightGray = new Paint(pm);
		lightGray.setColor(Color.argb(0xff, 0xcc, 0xcc, 0xcc));
		lightGray.setStyle(Style.STROKE);
		 
		 
		 
		Rect r = new Rect(10,10,dl.getWidth()-10,getHeight()-10);
		pm.setColor(Color.argb(0xcc, 0xff, 0xff, 0xff));
		canvas.drawRect(r, pm );
		canvas.drawRect(r, lightGray);

6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getHeight, getWidth
            mTextBounds.setEmpty();
        } else { 
            //Measure text bounds 
            float desired = Layout.getDesiredWidth(mText, mTextPaint);
            mTextLayout = new DynamicLayout(mText, mTextPaint, (int)desired,
                    mTextAlignment, 1.3f, 1.0f, false);
            //Log.i("tttt", "Ancho: " + desired + " textSize: " + getTextSize() 
            //        +" textLayoutWidth: " +mTextLayout.getWidth()); 
            mTextBounds.set(0, 0, mTextLayout.getWidth(), mTextLayout.getHeight());
            Log.i("tttt", "Alto text: " + mTextLayout.getHeight());
        } 
 
        //We may need to be redrawn 
        invalidateSelf();
    } 
     
    public float heightText(String text) {
        float desired = Layout.getDesiredWidth(text, mTextPaint);
        DynamicLayout d = new DynamicLayout(text
                , mTextPaint, (int)desired, mTextAlignment, 1.3f, 1.0f, false);
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getHeight, getWidth
            mTextBounds.setEmpty();
        } else { 
            //Measure text bounds 
            float desired = Layout.getDesiredWidth(mText, mTextPaint);
            mTextLayout = new DynamicLayout(mText, mTextPaint, (int)desired,
                    mTextAlignment, 1.3f, 1.0f, false);
            //Log.i("tttt", "Ancho: " + desired + " textSize: " + getTextSize() 
            //        +" textLayoutWidth: " +mTextLayout.getWidth()); 
            mTextBounds.set(0, 0, mTextLayout.getWidth(), mTextLayout.getHeight());
            Log.i("tttt", "Alto text: " + mTextLayout.getHeight());
        } 
 
        //We may need to be redrawn 
        invalidateSelf();
    } 
     
    public float heightText(String text) {
        float desired = Layout.getDesiredWidth(text, mTextPaint);
        DynamicLayout d = new DynamicLayout(text
                , mTextPaint, (int)desired, mTextAlignment, 1.3f, 1.0f, false);
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
                true); 
    } 
 
    @SmallTest 
    public void testDynamicLayoutTest() throws Exception { 
        Layout l = new DynamicLayout(mString, mPaint, 200, 
                Layout.Alignment.ALIGN_NORMAL, 1, 0, 
                true); 
    } 
} 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
mIsStale = false;
    } 
     
    private Layout createWorkingLayout(CharSequence workingText) {
        return new DynamicLayout(workingText, getPaint(), getWidth() - getPaddingLeft() - getPaddingRight(), Alignment.ALIGN_NORMAL, mSpacingMult, mSpacingAdd,
            false); 
    } 
} 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
	 
	private TextPaint paint = new TextPaint();
	private DynamicLayout textLayout;
	 
	protected void setEditable(Editable edit) {
		textLayout = new DynamicLayout(edit, paint, 100, Layout.Alignment.ALIGN_NORMAL, 1, 0, false);
	} 
	 
	protected TextBox(Tool mTool) {
		super(mTool);
	} 
 
	@Override 
	protected void computeBoundingBox() { 
		// TODO Auto-generated method stub 
 
	} 
 
	@Override 
	public float distance(float x_screen, float y_screen) {
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related Android DynamicLayout Questions & Answers:

See Code Examples for Android DynamicLayout Methods: