Changing the drawable/src of the setMyLocationButtonEnabled(true) - android

As the title says I would like to programmatically change the icon of the crosshair in the setMyLocationButtonEnabled(true) button. If this is not possible, I would like to know how to tint the icon if possible. If it's unclear which button I'm talking about here is a photo.
Edit 1: While the link provided by Zainal Fahrudin does address how to move the button, I am still unable to tint the icon itself without tinting the whole button or replace the icon. Below is what I have now. You can see the black icon on top of the blue icon in the background.

Related

Where can I find the list of allowed colors for android notification icons?

It seems as if android doesn't except all colors.
When I set it to a certain green, the icon is green but different. Same goes if I try a certain red for example. It's like android sets it to the closest color out of a list of allowed colors.
Is there a list somewhere I can choose from?
I'm talking about the color of the icon on the top left.
for the notification icon color , first the icon should be in white color , all of it and then you can customize the color you want within your builder :
mBuilder.setColor(ContextCompat.getColor(context, R.color.colorPrimary));

Android Toolbar home as up indicator material design click effect not shown

I'm working on an Android app with some Material Design features. Currently I'm trying to fix the toolbar, but I have one problem, namely: When I press the home as up arrow to go back to the parent activity, it brings me back to the parent activity but doesn't show a ripple effect (so you see that it is clicked..)
The only thing I do to set the home as up arrow is:
this.getSupportActionBar().setDisplayHomeAsUpEnabled(true);
inside my activity.
Found the bug, it was the color of the toolbar. I chose a very dark green color and therefore the click/riffle effect was not visible. Changing the color to something bright fixed the problem for me..

How to match the menu bar/notification bar color match application

I have an Android app which allows the user to change the color of a background based on the selection they choose.
This is the line that changes the color:
appBackground.setBackgroundColor(Color.rgb(inRed, inGreen, inBlue));
How do I also change the menu bar color as well the notification bar to change to that color of the user's choice?
I know it's only possible in KitKat but can someone point me to the way...
If you would like an effect like the image below, have a look here:
Why can't we use a Translucent system bars with and ActionBar
As you can see, the background color can be changed programatically (so it's not defined in the xml).

actionbar up button, extend click area when no title or icon

My actionbar does not use an icon or a title, this makes the click area of the "up" button very small. How can I have a larger click area without a title and icon in the actionbar?
You can put an image where the app icon would be. Just make a transparent image to the width and height for each drawable size you need and put it in the drawable folder, call the image logo (#drawable/logo). You then need to tell the activity to use the logo, it's not hard and these links should help.
http://developer.android.com/guide/topics/ui/actionbar.html
http://developer.android.com/guide/topics/manifest/application-element.html#logo
One way to do it would be to set a custom icon for the "up" button in your app theme as so:
<item name="android:homeAsUpIndicator">#drawable/your_drawable</item>

Transparent Tint on Buttons

In my Android app, I'm trying to get buttons to be tinted a certain color (either blue, red or gold). The default button tint is grey. Does anyone know how to change the color of the button so that the transparency remains with it?
I tried using:android:background
but that ditches the transparency completely and makes the button one solid color.
I also tried using:android:#color/transparent
but that ditches the color completely in favor of a fully transparent button. I've looked online for a while and found mostly stuff relating to image buttons. The kind that I'm trying to tint is just the standard Button buttons. I'm also guessing that this can be done mostly just through XML. Is that correct?
You could try and create your own button drawable like so...
Take the button drawable from the Android SDK ([ANDROID_SDK_HOME]/platforms/data/res) and import the drawables into your project. Then create a layer list with the button drawable on the bottom and a semi-transparent color on top.

Categories

Resources