Android- How can I show text selection on textview?

前端 未结 2 1466
猫巷女王i
猫巷女王i 2020-12-01 07:15

I am implementing a epub reading app where I am using textview for showing text of epub. I want to select text from textview when user long presses on textview and then do m

2条回答
  •  再見小時候
    2020-12-01 07:32

    It depends on the minimum Android version that you'd like to support.

    On 3.0+, you have the textIsSelectable attribute on the TextView, which enables this behavior. E.g.:

    
    

    Below that, you best bet is to use an EditText that looks and behaves like a TextView (apart from the slection thing). Or you can implement this feature yourself using spans.

提交回复
热议问题