问题
I have seen many question like this here and lots of solution but nothing is working for me. below is my EditText xml
<EditText
android:id="@+id/summary_edittextview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="10dp"
android:lines="15"
android:maxLength="1000"
android:textIsSelectable="true"
android:textSize="16dp"
android:backgroundTint="@color/colorPrimaryDark"/>
I tried to do textIsSelectable=true which makes edittext disable and nothing happens, I tried using cursorVisible=true but that also does not solve my problem. Please help i want to allow user to copy text which is inside EditText
More Details:- This EditText is under layout of fragment and I am using this style as app theme
<style name="AppTheme.Dark" parent="Theme.AppCompat.Light.NoActionBar">
even if i remove textIsSelectable=true it doesn't work. Please help me where i am doing mistake.
回答1:
As @Ashwin Mothilal said What do you want to do?
OK fine. FYI, textIsSelectable is indicates that the content of a non-editable TextView can be selected.
(An EditText is always selectable, so textIsSelectable is not necessary for an EditText.)
If you DO add android:textIsSelectable to a EditText the text IS selectable, but the field is NOT editable, nor is the cursor visible.
回答2:
Your code worked for me when I removed android:textIsSelectable="true".
回答3:
Its style problem, change it to following to check it works or not?
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
来源:https://stackoverflow.com/questions/43092781/textisselectable-not-working-with-edittext