I am using this android:textIsSelectable="true" in my TextView for select + copy-paste options and it's working just fine. But I just run into a problem, The selection part appear to be transparent in color. attaching the screenshot for understanding
Now I want to change the color of the selected portion . Is there a way to change the selected portion color.Any help is greatly appreciated.
Edit
Ok ,I seems to have find the issue.The issue was because I was not calling super on onDraw() instead I was drawing the text ie canvas.drawText() I made a small workaround for it, which is not perfect.Does anyone know how to set the highlight path using canvas.drawText() ?
Related
Yesterday I asked a question about the TextView. I read and I see that it's very difficult to understand. So, I'm sorry.
Now I explain better my problem:
I try to personalize my TextView. I tried two different things:
I use photoshop, I made an image text and I use it as a drawable. The image re-sized isn't with right quality
I try to use the text of TextView, but I can't change the family of the text (the app crashed). Then I don't know how to set gradient as text color and border in the text.
What can I do?
Edit: yes! For the point 1 I use an ImageView inside of TextView. In point 2 I use TextView. I have problem in both situation!
I think to customize textview (any view) you have to implement your own custom view by creating your custom class.
Here is link for custom text view,i hope i will find it useful
http://www.jayway.com/2012/06/25/creating-custom-android-views-part-1-extending-standard-views-and-adding-new-xml-attributes/
I have an image which include 10 boxes on my image view. When I click the one of boxes I want to change color of box (fill with color). How do I do that? Should I use Surface View or something else?
Update:
I found a solution. But if I use AsyncTask the code does not work. If I use a normal class the code works. I do not know why but I think problem is related with invalidate().
In my project i have 9 editext box one page and am set a background for all these things,am use font serif fonts.in that am going to edit through virtual keyboard.edit text shows only after few seconds how to am going to rectify tat problems..any one know help me...
Likely the background is getting stretched, which Android isn't really good with performance-wise. Use a background color or shape instead of image, or make the background repeat instead.
In the following picture you can see an android.widget.EditText (left half) where some text is selected:
Strange thing is: You can see the start and end marker of the selection but the actual selection is not highlighted.
I wonder what I forgot or what I did wrong here. How can I ensure that the selected area is highlighted using an appropriate background colour?
for more on StateList, refer this http://developer.android.com/guide/topics/resources/drawable-resource.html#StateList
After a little more experimenting I found the following:
the colour of the selection background is indeed set by android:textColorHighlight.
The selection is not highlighted when the entry field is in read only mode.
So for me there is nothing to be done about it and i just have to live without a highlighted selection.
I'm +- new to android and was wondering if it's possible to change only part of the text color in a EditText widget... Actually i'm making a notepad app where you would be able, for example, to write "bblablabal" and then click on the "yellow" button and keep writing in yellow color (the text written before doesn't have to change, as it does with the .setTextColor() method).
I've tried some of the java methods and also tried some workarounds with no succes... any ideas of how to makes this works ?
Thank you!
Rodrigo.
Yes, that's possible. Take a look at SpannbleStringBuilder.
More details: Android: Coloring part of a string using TextView.setText()?