How to make a custom text view selectable?

600 Views Asked by At

I use DynamicLayout to draw text on a custom view, now I want it text can be selected, what should I do next?

Now, I draw the text just simply like:

DynamicLayout layout = new DynamicLayout(mText,
            mTextPaint, getMeasuredWidth() - getPaddingLeft() - getPaddingRight(), Layout.Alignment.ALIGN_NORMAL,
            mLineSpacing, mSpacingExtra, true);

layout.draw(canvas);

Can someone tell me the step how to achieve it?

Update:

I have read this posts:

Android- How can I show text selection on textview?

The effect which I want is just like that post mostly, but I have not extend the google's TextView, I do it myself from View because of api 8+ compactable.

Can someone help me?

0

There are 0 best solutions below