tabris icon indicating copy to clipboard operation
tabris copied to clipboard

Caret Color in Text Widget not affected by setForeground

Open tschiessl opened this issue 10 years ago • 1 comments

Hello,

I am currently exploring the new features of Tabris 1.3 after upgrading from the 1.0 version. While still a lot of widgets in the app behave the same as in the older version, I have a problem with the Text widget. The situation is as follows: I am using the dark theme for my app, which is why I would like to have a white background in my Text widgets (otherwise it would be quite hard to find them since they'd have the same color as the background). But in order to let the user see what he enters in the text field, the text itself has to be black (the default white would again prevent the user from seeing what he enters). This works well for the text, but unfortunately not for the caret. The caret stays white, whatever color I specify for the foreground. This is a bit annoying for the user, since he can't see where he is currently typing. Furthermore it might be of interest, that I am not able to set the background color of the Text widget itself. The setBackground call has no effect on it, which is why I am currently using a white composite behind the widget (with the exact same size).

As far as I can remember, this approach worked perfectly well in the 1.0 version of the framework. This includes the caret color as well as the background of the Text widget itself.

Is there another possibility to change the color for a text widget's caret or do I simply miss something? Maybe this behaviour is not intended and should be fixed? For any suggestions I would be very thankful.

Tobias

P.S.: I am working on an emulated Nexus 4 device to test the application.

tschiessl avatar Apr 22 '14 05:04 tschiessl

In Tabris 1.3 we changed the behavior of the Android Text widget background color handling. Android does not use large indicators for text fields but rather a thin line at the bottom. When setting the background color we colorize that line.

I would not recommend to imitate a full box text field as it breaks the use expectation of an Android text field.

The caret color is is currently unchanged by the foreground or background color. If you really need to make and adjustment right now you could inherit your own Android theme and simply change the default color of the cursor.

See here for details: http://stackoverflow.com/questions/7238450/set-edittext-cursor-color

Let me know if you need any assistance.

mpost avatar Jun 24 '14 14:06 mpost