Set to global icons - android

so I have been searching for a good while, but can't seem to find anything about this!
I want to use the default icons that android provide so I don't have to make my own for everything. But every tutorial I can find says:
android:icon = "#android:drawable/star_big_on"
However, I'm looking for how I can do this for a marker that I have to set when created.
So I need something like this but for the default icons that android provide:
myMarker.icon(BitmapDescriptorFactory.fromResource(R.drawable.star_big_on));

You can try using:
myMarker.icon(BitmapDescriptorFactory.fromResource(android.R.drawable.star_big_on));
To use the android resources.

Related

AndroidStudio Adding an image to draw with srcCompat

I am trying to do a drawer activity with Android Studio and I'm wanting to personalize the icons used. I've downloaded the icons I want to use and for the most part, it's okay.
In fact, I can modify all the android:icon icons but I have no idea how to modify the app:srcCompat icons. I don't know how to detect the image I want to use in this case...
Do you know how I can do it? Could you explain this to me?
Thanks a lot!
Edit: The file I'm working on as a base is the generated project with Drawer activity as the main activity. For example, if I wanted to modify the icon in the nav_header_main.xml file, how could I do to have my image (.png) transformed in a way detected by Android Studio as compatible with srcCompat
Ensure your image file is in res/drawable folder(or drawable-xhdpi/xxhdpi, determined by your design)
Refer it by app:srcCompact="#drawable/$IMAGE_FILE_NAME" in your xml.
Then you should see what you want.
Please check the doc to further understand the official usage.
Well... I was blind! I was wondering how I could add my icons but they were, I was just mistaking on the address... #android:drawable/... is obviously not #drawable/... but I didn't notice. So be aware that there is a difference and it'll be okay I think!

ios version of themes and styles

As an Android developer new to iOS/swift, I am trying to implement a global theme/style which every view controller can inherit. I expect one file which I can modify which would affect all View Controllers's UI. This is possible in android. Does iOS have anything similar?
The best match for what you are looking for is probably UIAppearance, although not quite the same.
What it allows you to do is basically setup each component once, and then have that be the default look for all other components.
An example for setting button colors (you could do this in your AppDelegate):
UIButton.appearance().setTitleColor(.white, forState: .normal)
UIButton.appearance().backgroundColor = .blue
Try looking at these tutorials:
https://www.raywenderlich.com/108766/uiappearance-tutorial
http://blog.iseinc.biz/use-uiappearance-create-ios-app-themes
Usually if you want to do something like that, you can go to the AppDelegate File, and add code like the ones below:
[[UITextField appearance] setTintColor:[UIColor redColor]];
[[UINavigationBar appearance] setTranslucent:NO];
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
For example textfield by default has a bluish tint color, but with the code above, the default tint color becomes red. The single line of code you place will affect all UI related to it. Try it out.

Change default icon creating a new Android Eclipse project

Does anyone knows how to change the default icon that is embbeded here? In order that all new applications that you create has that icon instead the android default one.
I tried to look for it into /android-sdk-linux/platforms/android-[VERSION]/data without success. :( Is it named ic_launcher.png?
Thanks in advance!
EDIT: Please read before vote or answer. Is not how to change the icon app, this Q is about how to make it default for ALL new projects.
:)
For the interest of everyone:
The default icons are in this path:
/eclipse/plugins/com.android.ide.eclipse.adt_xxxxx.jar/templates/
Here you can define also a new default package and a header for ALL your activities.
If you intend to change your launcher icon just modifying your manifest.xml; Please refer to http://developer.android.com/
This way you can have a different icon for each project. If you just want to change the default one I dont see what is the purpose of it but maybe it is defined in your adtbundle here: \YOUR ADT BUNDLE\sdk\tools\apps\SdkController\res

How to style the children Views from the parent View?

I am currently trying to get the look of my app right. But I am having problems figuring out how to even set up a way to change themes. For one thing, is there even a way to change styles through code? I checked the method list and I saw nothing. This leads me to my actual question; is there a way that, like CSS, in which you style the parent, and then have it trickle down but also changed depending on the View? I looked at the Android docs, and they did not show any examples of this. Hopefully someone can give me an idea as to how to accomplish this, or if its not possible, to let me know that as well. Thanks in advance.
You should be able to do this using styles and themes. I've implemented this using Jake whartons Sherlock action bar. (I'm not certain if it's necessary) It involves using the comparability library which gives you the ability to use fragments and loaders as well. Look at his democode at http://actionbarsherlock.com/download.html. Look for where themes are mentioned and you will find the information you need. In the demo app you can change the theme in the top right corner and see how it affects the activities look and feel. It also shows many of the features available and the code to write them. I have found this an invaluable resource and it should show you how to theme your app.

Dynamically Updating Launcher Icon in Android

I am trying to put a dynamic value in the launcher icon of android, as number of messages will be displayed in the message icon. As the icon is static and initialised before the application starts, Is there any way to achieve this??
For Android Launcher Icon you can't. It is impossible. (Or by Making your own launcher) The only one thing is you have to make a Android-Widget for this purpose. Which looks like a application icon. But it will act as a widget.
Also Make a dynamic launcher icon
simple answer is you can't do it also this question says the same. But there may be advance tricky methods/ways that I'm not aware of.
But you may try and develop widgets that changes dynamically.
You have to design your icon as a selector instead of drawable. Have a look at this.
You cant update because its related to manifest.xml stuff only possible with software upgrade.

Categories

Resources