0

I am developing an application using Phonegap 2.5/Sencha touch 2.2 in android device which has Android OS 4.1.2 running on it, On Selecting text in text fields, at the begin and end of text selection, two arrow kind icons appears(android Default text selection image). Is there any option to show/hide those icons at application level in android?

enter image description here

yrkapil
  • 444
  • 2
  • 7
  • 17

1 Answers1

0

Disabling text selection altogether would be easy, but I'm not sure that's your aim. You could always EditText.clearFocus(), setSelected to nothing, or remove the selection spannable.

Creating a selection without the handles, however, isn't as easy. The whole application of the selection spannable along with the visible handles and selection background is done after the super calls to the various onTouch(), onLongClick(), functions.

In short, you're blocked off from dealing with those directly. You could try changing the drawables of the TextSelectionhandles to something transparent, small, or more appealing. It may result in wierd behavior (idk) because they are technically still there, just invisible.

I borrowed some code from this post, to show how to change the drawables:

<style name="MyCustomTheme" parent="@style/MyNotSoCustomTheme">
    <item name="android:textSelectHandle">@drawable/text_select_handle_middle</item>
    <item name="android:textSelectHandleLeft">@drawable/text_select_handle_left</item>
    <item name="android:textSelectHandleRight">@drawable/text_select_handle_right</item>
</style>
Community
  • 1
  • 1
NameSpace
  • 10,009
  • 3
  • 39
  • 40
  • I am building a phonegap application .. is there a way i can refer this style inside the AndroidManifest.xml – yrkapil Aug 07 '14 at 12:28