J jai Active Member Licensed User Longtime User Mar 8, 2022 #1 How do I change the color of cursor for input in EditText. Prior Android versions work ok but the cursor is barely visible on white EditText box on recent versions of Androids. I have tried earlier posts on similar topic but none has produced desirable results. Appreciate any help.
How do I change the color of cursor for input in EditText. Prior Android versions work ok but the cursor is barely visible on white EditText box on recent versions of Androids. I have tried earlier posts on similar topic but none has produced desirable results. Appreciate any help.
Erel B4X founder Staff member Licensed User Longtime User Mar 9, 2022 #2 1. Have you tried this: https://www.b4x.com/android/forum/t...cursor-more-visible-solved.114148/post-712996 ? 2. How are you setting the EditText color? Maybe you are using the wrong theme. Upvote 0
1. Have you tried this: https://www.b4x.com/android/forum/t...cursor-more-visible-solved.114148/post-712996 ? 2. How are you setting the EditText color? Maybe you are using the wrong theme.
J jai Active Member Licensed User Longtime User Mar 9, 2022 #3 Thanks Erel! Before I start making elaborate changes as per #1 let me run by you my needs again to be sure that your earlier suggestion is the right way to go. I have many arrays of EditText boxes that are dynamically created to input data and perform associated computations for each input. I have been using the following to maintain a visible black cursor in each EditText B4X: Copy Dim CursorColor As ViewSetting CursorColor.setCursorDrawableColor(txt1(I),Colors.Black) This is a simple passive setting that works fine for formatting textboxes for a visible black cursor on all devices tested until Android 7. What I am looking for is an equivalent that would also work on more recent versions of Android. I am hesitant to undertake more elaborate changes for the sake of a black cursor on some devices. My text boxes are white and the theme is Holo B4X: Copy SetApplicationAttribute(android:theme, "@android:style/Theme.Holo") If there is no easy alternative could someone please post sample code to implement the modifications suggested earlier. Thanks. Upvote 0
Thanks Erel! Before I start making elaborate changes as per #1 let me run by you my needs again to be sure that your earlier suggestion is the right way to go. I have many arrays of EditText boxes that are dynamically created to input data and perform associated computations for each input. I have been using the following to maintain a visible black cursor in each EditText B4X: Copy Dim CursorColor As ViewSetting CursorColor.setCursorDrawableColor(txt1(I),Colors.Black) This is a simple passive setting that works fine for formatting textboxes for a visible black cursor on all devices tested until Android 7. What I am looking for is an equivalent that would also work on more recent versions of Android. I am hesitant to undertake more elaborate changes for the sake of a black cursor on some devices. My text boxes are white and the theme is Holo B4X: Copy SetApplicationAttribute(android:theme, "@android:style/Theme.Holo") If there is no easy alternative could someone please post sample code to implement the modifications suggested earlier. Thanks.
Erel B4X founder Staff member Licensed User Longtime User Mar 10, 2022 #4 jai said: My text boxes are white and the theme is Holo Click to expand... This is very bad. Why lock your app to such an old theme? As far as I know the only way to change the cursor drawable is by loading it with XmlLayoutBuilder. The real issue is the theme. Select the correct theme and everything will look fine. Upvote 0
jai said: My text boxes are white and the theme is Holo Click to expand... This is very bad. Why lock your app to such an old theme? As far as I know the only way to change the cursor drawable is by loading it with XmlLayoutBuilder. The real issue is the theme. Select the correct theme and everything will look fine.
J jai Active Member Licensed User Longtime User Mar 11, 2022 #5 A change to a light Theme improved the cursor visibility markedly, nicely serving my purpose. Thanks Erel for the guidance! Upvote 0
A change to a light Theme improved the cursor visibility markedly, nicely serving my purpose. Thanks Erel for the guidance!