How to increase text size of option menu programmatically? - android

I need to increase the font size of option menu. I do search web for this but all i got is to modify android option menu's internal view(com.android.internal.view.menu.IconMenuItemView ) to change text size. But i am looking for a way without modifying any kind of internal view's as it is not recommended. Can anybody please refer me a document or source code that will do my task(change android option menu item text size programmatically). Any kinds of link resource's is really appreciable.
i got this type of answer that is really helpful, but all i want a simple & elegant solution.

Related

Adding text to a notification icon

I want to make a notification icon with text over it, to show for example the percent battery remaining. Is there a way to do that that doesn't involve 100+ separate icons?
I've looked all over but couldn't find a way.
Thanks
100+ separate icons unfortunately. Because of security reasons android only accepts resource IDs that also must not be custom resource type.
Would be happy to know if I'm wrong though.

How do I customize the look & feel of a Gallery?

I'm having a hard time understanding how I can create my own Gallery item. Specifically, I want to alter the appearance of the rectangle that surrounds whatever is the currently selected item (and remove altogether the rectangle that surrounds the non selected items).
Is there a good tutorial on how to create my own styles and pass them into my Widgets?
[Edit]
When initializing my gallery I hand it this
R.styleable.GalleryTheme_android_galleryItemBackground
and
R.styleable.GalleryTheme
I'm sure if I could crack those open, I could then copy and alter into what I want.... but where does Android store these?
[/edit]
The contents of those themes can most likely be found some where in the source code of the Android Open Source Project. It'l probably be somewhere here in the resources folder
Ok... this thread answers the actual question:
Android Hello, Gallery tutorial -- "R.styleable cannot be resolved"
Hope it helps someone.

Android R.drawable icon to reduce zoom

In the Android list of R.drawables (http://developer.android.com/reference/android/R.drawable.html) I can find the ic_menu_zoom button, which have a little plus sign inside.
Does anyone know about a similar menu button, but with a minus sign? I can't seem to find anything in the reference.
Thanks.
You are looking for the wrong kind of icon. It clearly says that it is a menu icon ic_menu_zoom.
What you are really looking for is the btn_plus_ and btn_minus_ icons. Note that I've omitted the states. You'd actually want all button states to combine them into a StateListDrawable.
Alternatively you can take a look at the btn_zoom_ icons.
Maybe try btn_minus_default and btn_plus_default.
Edit:
Or check out this link.

How to display default group icons in ExpandableListView?

I'm finding lots of discussion about how to replace the default group icons in an ExpandableListView, but I'm not coming up with anything on how to get the defaults to display in the first place.
The defaults (as shown here, if that's what they look like [new to Android, this is my first ExpandableListView]) will be fine with me, if I can get them to show.
I'm using the sample code from the article; I have no need for the embedded CheckBoxes at this time.
Any assistance is appreciated.
--EDIT--
Also, does anyone have any theories as to why the default icons show in the article (again, if that's what they look like--if someone could confirm that'd be great) but don't show for me?
If you are using custom layouts for your group rows the default icons are overridden by your layout. You'll need to add them to your layout in order for them to display.
you can changed default icon with your own icon as below.
android:groupIndicator="#drawable/image"

How to Get Android System Colors

I've seen references on how to SET system colours, but I need to find out how you GET them - how do you find out what they are?
On the Samsung Galaxy S for example, the tab views, ListView highlights when you select an item, and the Summary text line on the preference screen are all blue.
There are many apps which immitate this style and I want to do the same. Obviously I cannot just hard code and set the colour to Blue, as other handsets use different colours.
The question is, is there a way to programmatically find out what colour the Preference Screen Summary Line, Tabs, or ListView selections are, so that you can then set that against a TextView elsewhere in your app?
How do I get the android system colours?
There is an answer to this question, but it is probably not the one you wanted to hear. There is no way to reliably do this. The "selection color" is actually part of a nine-patch image, which is provided on a platform specific basis. Some use the standard orange color, some (Sense) uses green, and others use red. With an exhaustive list of these you might be able to create a mapping from hardware to color, but this is not very effective because new hardware comes out all the time, and some of these phones allow sense to be uninstalled.
The only real thing you can do is to make your buttons consistent within the application itself, which is a hard enough task by itself. If you really have to have a custom item with a selection color (which is common enough), then my advice would be to copy the button resources from the platform of your choice (I like the default sdk resources myself) and then manually set them throughout your application. This way they will always look the same no matter which platform you are on, and so will always match your custom views. Note that this will require you to do more than just buttons. Dialogs and menus also will need to be modified, which is possible, but hard.
Really this is a flaw in the way Android was designed, and it causes a lot of us grief. I wish I had a better answer for you, but I think this is the best we've got.
You can specify colours to elements in your XML layout using the #android:color system variable:
<TextView android:background="#android:color/white" android:textColor="#android:color/black" />

Categories

Resources