I want to make a custom checkbox for my Alarm clock app, to match the days of the week. When unchecked, it would display the letter of the day of the week; when checked, it would show the letter in a circle. If needs be, I can always make a vector image of each state for each of the days; but it seems that if possible, it would be much more simple and useful to be able to superimpose the text over top of the checkbox image. On researching, it seems people used to have problems with this happening on accident when setting the padding to 0, but this was fixed and is no longer an option.
Does anybody know if there is currently a way to accomplish this by design? Another option I thought of is doing this in a normal button and adding checked functionality, but this seems like taking a step backwards and reinventing the wheel. Any thoughts?
It was so obvious in retrospect, it makes me regret how long I spent Googling it. A negative paddingStart will move the text back over the chechbox, but will cut off the end of the checkbox - at least in the GridView it was a part of. Adding a paddingEnd sufficient to counterbalance it pushed the grid back to the right so it wasn't cutting off the end of the checkbox.
Related
I have my EditText view looking almost the way it's supposed to look. However, since the text's gravity is set to "center", the highlight behaves a little different than I would expect if it spans more than one line. Take a look:
I wonder if it's possible for the highlight to look more like this (edited in photoshop):
As an added bonus, if there is a way to have the beginning pink handle line up properly with the first word, that would be great. As you can tell from the first image, it's offset downwards and looks broken.
Thanks
I'm looking forward to create an EditText with an Icon on the right that has some kind of functionality.
I've seen that the Google IO 2013 app has something like that on the search widget.
I want to know if its possible to do that with a simple EditText.
I've tried with a simple ImageView on the right of the EditText, but it looks really bad.
I would really appreciate if someone could point me in the right direction.
Thanks.
EDIT 1
This is an example of what I want. It looks really good. I have used the drawableRight and it doesn't look this good.
http://img836.imageshack.us/img836/1521/6faa.png
EDIT 2
I managed to build something that looks really similar to the SearchWidget with the voice recognition option.
I put two EditText next to each other (with a RelativeLayout), and set the margin left for the one on the right to -10dp. This way it looks like one EditText. I know this is not proper, but right now does what I want.
My problem now is the image, I'm using a 32x32 px image, because it fits fine, but it has really low quality, I'll look into that.
http://img560.imageshack.us/img560/9394/ilwp.png
You can definitely use a custom EditText with drawableRight as follows:
android:drawableRight="#drawable/your_drawable"
Refer
1.Custom EditText- 1
2.Custom EditText- 2
This is quite hard to understand, but I'm trying to find out how to make a TextView adapt to change the text spacing between words on a line which allows the text to reach the very right side of the TextView.
Consider this as an example (this should get my point across):
This one is a line of text which fills the view itself
This is another that does the same thing
How would I go about making my text react like this? An example application which does this is Pocket, so I know it can be done - I just don't know how.
Any help is appreciated!
What you're referring to is called text justification and is something that has been discussed more than once here on SO in the context of Android.
The short answer is that, unfortunately, justification is currently not (natively) supported by the TextView widget. There are however workarounds that involve either:
Manipulating the text in the TextView in such a way that the result is visually close to that of justification. Example.
Using a WebView to render the text. Example.
Justifying text on a web page is trivial, but the WebView is a more heavyweight component than a TextView, and hence the feature will come with a performance penalty.
Note that I don't know what approach Pocket is using for their articles, but there are ways to figure that out, and they're not too complicated. That's a completely different can of worms though, so I'll leave it at that.
I'm trying to create an android program that features text fading in but not all at the same time. For example, I want the sentence "The boy is tall" to fade in first with "the boy" and then have "is tall" fade in next to that. I've been working on this for awhile now and can't figure out how to do it. Also, I tried setting a spannable that contained different parts of the sentences and animating those but that didn't work. Does anyone know how to perform this on android?
Goal: have a LIstView show a list of text strings. The user can select an item by touching it. The selected item is visibly different to those not selected.
In short I want to have a simple scrolling list box that works using trackballs AND touch mode.
There are many posts asking for this, but none seem to get an adequate answer. This is such a simple requirement, why is there no article on this?
I looked at http://developer.android.com/resources/tutorials/views/hello-listview.html but that won't work in touch mode: the orange background is displayed, something unachievable in touch mode without extreme geek wizadry, for something that is quite frankly what all newbies expect out of the box.
I suspect that the only way to achive a touch mode selectable listbox (ListView in google speak), is to stick radio buttons in there. All of a sudden my little text list view is beccoming a monster.
Can anyone explain the simplest way to do a single choice ListView that displays the item selected so the user can figure out that it is selected, in touch mode? After fumbling for days, I really am not fussed if it has radio buttons, singing cockatoos, or whatever, so long as it's simple to code.
Here's the example that Google provides:
http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/List10.html
It uses radio buttons
Wat do u want to do? Just highlighting the row in the ListView which is selected.rt? for this u can use this.
android:listSelector="#drawable/highlighter"
android:drawSelectorOnTop="true"
Write this code in your XML file