Code example for Layout

Methods: getText

0
 
    @TargetApi(ApiHelper.VERSION_CODES.ICE_CREAM_SANDWICH) 
    @Override 
    public void onPopulateAccessibilityEvent(AccessibilityEvent event) {
        super.onPopulateAccessibilityEvent(event);
        CharSequence text = isChecked() ? mOnLayout.getText() : mOffLayout.getText();
        if (!TextUtils.isEmpty(text)) {
            event.getText().add(text);
        } 
    } 
 
    private Layout makeLayout(CharSequence text, int maxWidth) {
        int actual_width = (int) Math.ceil(Layout.getDesiredWidth(text, mTextPaint));
        StaticLayout l = new StaticLayout(text, 0, text.length(), mTextPaint,
                actual_width,
                Layout.Alignment.ALIGN_NORMAL, 1.f, 0, true,
                TextUtils.TruncateAt.END,
                (int) Math.min(actual_width, maxWidth));
        return l;
    } 
Contextual code suggestions in your IDE  Get Codota for Java