Fill with Color on Android - android

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().

Related

How to change selected text color inTextView?

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() ?

Android, Simple box inside a button?

I want to have a button like the one in the link below. How can i achieve it just by java code or xml? By the way it's going to be of a different color when pressed. I've explored similar posts but none helped. Any help appreciated.
The button which i want
Just make a View with large rectangle and add what you want(e.g. Label contains 'Number Of Students' and/or something else) in the view.
Then, add onClickListener to the View.
To change clicked colour, refer to here

How can I personalize my textView?

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/

How to show and edit text inside of a free-form shape - impossible on Android?

I want to
use a TextView (or similar) to show dynamic text inside of a free-form shape (as shown below)
enable the user to change the text
render the result into a Bitmap
It's a relative easy task on iOS but it seems nobody did this on Android?!
I hope someone has an idea how to solve it, can't find anything on the net...

Android: How to change the default shape of a button?

Is it possible to change the default shape (i.e rectangular) of the button (normal button as well as imagebutton) to something else maybe like star or a triangle in Android? Any tutorials or sample code would be much appreciated.
That depends on how you define "shape".
Visually, you change the shape by changing the button background resource. See this previous SO question and answer.
However, I haven't tried this with something non-rectangular, so it is possible that while it will look like a star, the "hot zone" for clicks might still be the original rectangle.
You might look at the implementation of RatingBar in the Android open source code, which uses stars, and see if they do anything unusual.

Categories

Resources