Change colour scheme of phone specific UI elements (Selected Buttons / Selected EditText) - android

I'm working on a Nexus S and the phone theme uses Black and Orange. I started with a custom button - changing the background from #android:drawable/btn_default to my own 9 Patch image. This is fine and dandy and there are 100's of tutorials and examples of such littering Google.
The problem is I don't want to create a different style of button. I want the UI in my app to as insofar as possible to stay true to the phones own buttons and UI elements. What I want is to create a custom button which looks exactly like android:state_pressed="true" and android:state_focused="true" but instead of orange, blue.
I also want to do this for selected EditText & Spinners and the like.
Am I doomed to backwards engineer each element, guessing each pixel, one for each state and create 9 patch images of them? That's what I've done below for the blue button - as you can see, close but not exact.
Has android given these buttons out somewhere - if that was true it would take an afternoon but it wouldn't be unreasonable to create the same UI set in a different colour.
Or is the a programmatic way of saying "For this app use this theme" that I've just never heard of (Big ask).

If you look in the Android SDK folder under platforms you will see all of the different SDk levels that you have downloaded. Inside each there is a data/res/drawable folder where there are all of the images used in the UI. You can modify those and add them to your own resources. But yes, any change you want to make to the default UI you will need to implement yourself.

Related

Android - How to change Default Loading Screen(Screenshot)? [duplicate]

The app itself works completely fine. My question is that on the launching of the app itself, the screen is the Unity default blue for a quick second or so before changing to the black of my first scene.
How do I change this color to be black on startup?
You can change this by going to File --> Build Settings --> Player Settings --> Splash Image --> Background --> Background Color.
From there you can change the background color. You can also change the image, animation type and overlay opacity from there.
Note that there are things you may not be able to change there unless you have Pro license.
EDIT:
Updated to be more detailed of where to change stuff
First change the Splash Image:
There are more options for iOS platform but this settings can still be found in the menu I mentioned above.
If iOS, select iOS as your platform and you can change your Background Color from there:
You should then change the Lunch Screen type from there. Set it to None if you want it to be gone.
If the color does not still change, you can create a Texture with a color of your choice and add it to the Mobile Splash Screen slot:
I believe the OP was looking for the Background Color of the Launch Screens as indicated in these screenshots.
This is taken from an iOS build setting panel. We've observed odd behavior with no textures at all (even though that is what we want), so we use single-pixel, solid-color images as well as a background color to match.
These fields are not made available in the PC/Android build windows, so not 100% sure what the equivalent would be - beyond using flat-colored images. Either way, it is these elements that are used prior to loading your scenes.
I think you are talking about the camera background color. You can set it up in your main camera to black. You can find the camera documentation here.

Custom Shape Button Android

I have to address this type of views which has buttons below example.
http://www.planet1107.net/blog/custom-shape-uibutton-tutorial/
It is in the iOS. so is there any way to make it in Android.
I also have to give click events on all of those buttons.
I would recommend just exporting these custom images to pngs. Then adding the pngs to your Android project and simply referencing them in the code or XML. Then on a click event you can simply change the icon to indicate that it has been clicked and if the user clicks on it one more time change it back.
This will also ensure that the Android images look identical to the iOS ones.

Strange background of text in custom theme

I recently updated my app, changing it's design a bit. Amongst other things, I styled buttons with custom drawables (well - not exactly custom, just taken from ICS release). Everything works well, except for one of the users.
Instead of:
He sees:
This is a Button, but I have also other controls styled with the same background drawable and the problems appears there (so, it's not limited to buttons).
There are two changed style properties that these controls have in common. One is, of course, a background drawable. The other is textAppearance:
<item name="android:textAppearance">?android:attr/textAppearanceMediumInverse</item>
I came to a conclusion, that this user is using some strange theme, which alters the default value of textAppearance* styles. But I have no idea what attribute may control this "text background color" (android:background does not work, checked this just in case). Or maybe I'm looking in the wrong place and this problem is not related to textAppearance?
EDIT:
The background image is a semi-transparent PNG file.
Android version 2.3.7, Motorola Milestone. That's all I got.
EDIT 2, Fixed:
OK, the problem was at the users side, it turned out he was using CyanogenMod7 with forced 16bit trasparency. After switching that option off, everything works.
OK, the problem was at the users side, it turned out he was using CyanogenMod7 with forced 16bit trasparency. After switching that option off, everything works.

Android Icons: Home Screen vs Applications Menu

On my Samsung Galaxy, application icons displayed on my Home Screen often don't match those displayed on the Applications Menu.
Firstly, I want to know if this is peculiar to Samsung/Galaxy (or some subset of Android phones), or if this is across the platform? Secondly, I'd like to know how to set this up in my Android project.
To illustrate what I'm asking, please refer to the following image:
Icons 1 and 2 are typical of a lot of third-party apps: on the Home Screen the icon transparency is honoured, but on the Applications Menu the icon is over-layed onto a button graphic. On my phone the latter is more-often-than-not a dirty-green, radial pattern.
Some apps have over-ridden this behaviour, however: icons 3 and 4 show that MapQuest has been able to specify a different base colour for the button (same radial pattern, though); and icons 5 and 6 show what appears to be a complete replacement of the button image or Application Menu icon.
Can anyone explain what I need to do to specify both forms of the icon in my project?
Thanks, in advance.
That particular effect is part of the Samsung Homescreen UI. It does something similar on the Galaxy Tablets.
icons 3 and 4 show that MapQuest has been able to specify a different base colour for the button
I don't think that they specified that I imagine that it is either luck of the draw(on Galaxy Tab there are many colors blue,green, orange, pinkish, etc...they don't appear to have any sort of pattern for which icons get which color), or it can tell that their icon is green also, and because of that it changes colors so that you don't end up with a green icon on top of a green backdrop.
and icons 5 and 6 show what appears to be a complete replacement of the button image or Application Menu icon.
I don't think they had control over that. I think it is just another one of the possible backdrops that the system uses.
Can anyone explain what I need to do to specify both forms of the icon in my project?
As far as I know you can't the backdrops are up to the 3rd part home/launcher replacement app. In this case Samsung's (but there are other home and launcher replacements on the market that could also use an effect like this if they wanted.)
Thanks, Tim - further playing around has revealed more...
As a result of refactoring my package names, I ended up with two copies of my app (with identical icons) on my Applications Menu.
As Tim suggested might happen, the second icon has a different, apparently randomly allocated, background. It would appear that the button colour is unrelated to any colour in my icon, however, as the same icon got allocated a different background.

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