I'm creating an app supporting versions 2.1 and up to what's currently available.
Now, I'd like to make use of drawables available to the user's current theme and/or Android version when designing the ActionBar I'm creating.
The drawables enabled in every version provided by Android are very crisp and non-ambiguous, perfect for my needs.
Problem. I can't access, for instance, #android:drawable/ic_menu_refesh in my XML-files throughout my project.
There is of course the possibility of copying icons from a specific android version and using those, but I can't really see how I would make this sanely working without copying every version of the icon from every build and keeping track of what version an Android is currently running and reference the suitable drawable.
Another issue, themes(?) such as Sense are making things even that much harder. In my app I'd like to use the device's current theme. In my case I have an ICS-device that uses Dark Holo-theme and a 2.3.6-device that uses its default theme. In these cases this means selecting a suitable light colored drawable for the ActionBar/menu.
Problem. In Sense on my HTC Sensation S the background color of menu items are white, which means I now have to pick a suitable dark icon.
How would I go about this to be able to use the device's current theme, and still provide adaptable drawables so they fit the look & feel of the theme?
If I'm understanding correctly, you are wanting to be able to just reference the default icons, say the "menu refresh icon", and have it appear as it does in the system apps. I do not know of a way to do this, and recall reading Android documentation that warning against referencing default drawables, as those icons may change in future versions of Android and your app will not look as intended.
Generally, you will need to create your own icons for each menu item/actionbar item/notification/etc. There are simple tools out there that can create custom and default Android icons for different system themes. You can use resource identifiers in your res folders to have different icons for different API versions/layouts/densities/etc.
http://android-ui-utils.googlecode.com/hg/asset-studio/dist/index.html
I do not understand why you are setting your icons to gray... What I think you are forgetting is that your app sets the theme, you can choose whatever system theme you want, or have a custom theme that extends from a system theme. Whether you choose dark or light, you only need icons for the theme you set. The only kicker here is to make sure you have icons for varying API versions that differ (i.e. menu icons 2.2 vs 2.3 vs 3.0+), and all you need is to make each API version and use resource identifiers to make sure your app uses the proper one.
If your app supports more than one theme, you can have it use different icons for each theme. See how to do so in my answer to a similar question:
Change ActionBar Menu Icons depending on Style
The only way I could make this work was by copying the icons I wanted provided by Android and then recolor them to a middle ground shade of gray. Not a very ideal solution but it will have to do.
Related
I'm trying to update an existing app, it's been a few years since the last update and I've updated Android Studio to the most recent version v3.5.3. Among other things I want to change the app icon, so I've updated all the PNG files.
However, in the emulator it keeps showing the old default icon.
If I understand correctly, there is a new feature since API-26 which allows for something called adaptive app icons, but I can't figure out how to update this icon.
The #mipmap/ic_launcher.xml file seems to be some sort of vector file, which describes paths and strokeWidth and lines to construct the default icon. I tried and searched all over, but I have no clue how customize this type of icon to something with my business logo.
Do I have to turn my custom logo into a vector image? If so, how can I do this? Using which app or utility? Can't I still just use my PNG files like previously?
For my app I need (like I think many and many devs) to customise colours and drawables; at the moment I need to customise a platform drawable (the action bar background, which for the android platform is ab_solid_light(or _dark)_holo.9.png) which can be taken from various sources (android.jar, git, etc.). In my case, I'd like to modify it from grey to another color; can I simply take it, modify it with gimp/Photoshop/similar application and include in my resources? Should I give credits to aosp in "open source licenses" section of my app? Is there a standard or conventional way to do these kind of things?
I'v been running my app on android 2.3.3 while i was building it and everything was looking fine, I have a lot of edit text's in the app, ones for input and one for displaying answers, the ones for displaying answers are set to enabled false and that changed them a slightly different color on 2.3.3, which I liked.
Now when I ran the app on version 4.1.2 all the edit text were black and I cant see the numbers that are input, plus cant see spinners
Is there a way to achieve something similar on all versions, when I set the background color of the edit text it makes it square, and I prefer the rounded corners.
There is two option
set the targetsdkversion to your minimum sdk version. By that you will see the same as it will always show the theme of minimum sdk version
or create your own background selector for edittext.
Users will usually prefer (at least i do) having a consistent experience across apps, so that using the native look and feel is something that you should consider.
If you set the targetSdk to a low number, it makes the whole app use an outdated UI , plus it can create a full row of the menu button on devices that don't have a dedicated menu button.
Of course , if you wish to change it all to your own style (which might be more beautiful), you can also do it by either have styles or extend the views. There is even a nice holo-style-library called HoloEverywhere that you can use.
I downloaded some free icons and created a notification. At first I thought something was broken but then I realized that the icon I had used was in the same color as the background.
The pack I downloaded included several versions like "holo_dark" and "holo_light". I assume that this has something to do with theming in different android versions or user customizable settings.
What is the intended way to figure out which icon to use in such cases?
The icons are specific to the theme that you will be using in your android application. You have to identify the theme in your application and then use the specific set of icons for your theme.
For more clarity you can refer the Android Asset Studio ActionBar and Tab Icon Generator and see the difference in icons generated for different themes.
Also this article will be very useful in understanding how Styles and Themes work in Android.
I'm looking to add a menu option to change the font size in my Android application. Most applications I've seen that have this option (Kindle reader, Google Books) use an icon like "Aa" to indicate the ability to change the font size, but I can't seem to find a standard icon for this for Android. Is there one? Or am I better off creating my own?
I know what you mean but cant think that android have a designated icon, I would advise creating one of your own. It's more fun creating your own anyway.