Android Lollipop system icons in Android Studio - android

How do I get the Android Lollipop system icons in Android Studio for use in my app? I am strictly working on Lollipop and whenever I try and do android:icon="#android/drawable/... I always get old Kit Kat era icons. I want the icons referred to on this page here. But I get stuff like this:
EDIT: Found a neat little plugin available for Android Studio. I created an answer to this question. Hopefully it will help others in the future who are looking to do the same.

After some more digging I found a great solution. Not quite exactly built in but it is a great alternative and I didn't find a 100% definitive answer on here so I'll make this post for future people.
So there is this plugin for Android Studio called Android Drawable Importer by a man named Marc Prengemann that will allow you to import whichever icons from the Lollipop system icons, given that you download them first.
To download them go here and you can download, they are also available on github. But, the plugin also offers the ability to download them. Your choice.
So to get the plugin go to:
WINDOWS: File > Settings > Plugins > Browse Repositories
MAC: Android Studio > Preferences > Plugins > Browse Repositories
and at the top search for Android Drawable Importer. It should look similar to this:
Click install and Android Studio will need to restart.
Next you are going to have to go back to:
WINDOWS: File > Settings > Android Drawable Importer
MAC: Android Studio > Preferences > Other Settings > Android Drawable Importer
and here is where you either download the icon pack or provide the path you stored them if you previously downloaded them (that's what I did here). It will look similar to this:
Now you are good to go. To add an asset to you project, right click on
WINDOWS/MAC: Drawable > New > MaterialIcons Import like so:
You will get a nice little popup window like this that will allow you to look through the different categories like alert or hardware or social and choose the icon, size, and which dimensions you want (hdpi, xhdpi, etc..):
Hope this helps some folks in the future. You don't only have to use it for material design icons, you could put whatever icons you want in the root path. Again, I didn't make this, just sharing the wealth.

It will depend on your target android version and also on the version you use for rendering in android studio.
Open the preview panel on the right of your xml, on the top left you can choose 'Android version to use when rendering in the IDE'. That only changes what you see in the IDE though.
Your app theme could also be responsible.

Related

Cannot click next in Asset Studio when creating an icon

Not sure where to post this issue I have with Android Studio IDE, I hope it can be answered here.
When I open the Asset Studio in Android Studio by right clicking on my Android Module and selecting new -> Image Asset I cannot get past the first screen. Even when I leave this default, when I try and press next the Asset Window start shaking shortly after a second or two.
I encountered this problem with a prior version of Android Stuido but an update to the latest version did not help.
I tried updating the android SDK and build tools since they are obviously related but without success.
I tried restarting Android Studio but the "bug" still remains.
Perhaps I am doing something wrong, I created a video of my workflow and the issue I am encountering.
I had the same problem.
In the Legacy tab, I set the Google Play Store Icon to No and I could pass the first screen.
I had exactly the same problem while I was trying to create adaptive icon from vector graphics.
What helped me was that I need to set Size to 108 dp x 108 dp when I imported Vector Asset (res -> right click -> New -> Vector Asset).
I have faced the same issue with vectors that had a dashed line. Android Studio doesn't support dashed-strokes by default. You can check what is not supported in this link Dashes stroke-dasharray in Android Vector. So in such cases Android Studio just doesn't show any error upfront.
In your case I see its happening even for normal vectors.
To check why its failing notice every time it fails the exclamation mark at the extreme bottom right of Android Studio turns red and flashes. Just close pop up window of Android Studio and click on the red exclamation mark. It will give you the reason why its failing. Although there was nothing much I could do about it maybe you can figure out whats wrong.
I know it's been answered but here's another thing that might fix someone else's problem when adding an asset and getting the weird shaky window error: check the asset dimensions you're importing.
I was trying to add a Vector Asset with dimensions about 23dp x 1077dp (really big height and small width), and for some reason Android Studio didn't accept it. After changing it to a dimension bigger than 170dp x 8137.3dp (it scales automatically) it worked. Then I went on the .xml file and changed it to a dimension I wanted, preserving the proportion of mostly 200dp in width or height as prompted by Lint in a warning.
I don't really know why it worked but I managed to add the asset. If anyone knows it, feel free to explain.
Steps:
1) Have you tried setting it manually through file explorer/directories etc.?
2) Maybe try a drawable importer? Like this.
3) Have a look at this answer, it might help.
4) Try completely uninstalling Android Studio, re-download and install again, if all else fails.
As per your project structure, I believe this is not a native application.
That's right, Flutter projects are not Android projects. Many Android tools are enabled only for projects that have an Android facet. Adding that to Flutter projects causes many problems, so we don't do that and this functionality available for only in native android application.
Furthermore,If you want to use may be it'll help you.
Open android studio File->Open folder->navigate to your flutter project and select the Android folder. Wait for it to sync, then navigate inside the Android studio folder and find the res folder right click on it and choose New you will see the Image asset studio.
This happened to me and the problem was that the dimensions of my source image were too small, which I think is the takeaway from all the other answers as well.
In my case the issue was caused by some unusual project structure, including some source directories added manually within the module.
The only solution was to create a new sample project in Android Studio, use the Asset Editor, generate all the assets to finally copy those to my "unusual" project.
One could also read the IDE (Android Studio) logs to see exception that are being thrown when the editor windows shakes as it's described by the Author of this thread.

How do I open a new project in Android Studio?

How do I open a new project in Android Studio?
I'm trying to open a new project
But instead of a window of quick opening
I get this screen
The project opens differently than usual
Has something gone wrong with definitions?
How do I get to a "quick opening" window
Thanks in advance for your help
At the bottom of your screen there are several error messages related to loading plugins, most notably:
Required plugin "Android Support" is disabled
I would bet that this is why you are seeing a different New Project dialog as your copy of Android Studio can no longer use Android-related functionality. In order to re-enable this plugin, go to File -> Settings -> Plugins and ensure that the entry for Android Support and everything else Android-related is checked.
You may need to restart Android Studio once you've done this.
I think you're already in a new project. Look at the paths in the top of the screen shot. It's asking you to set up the parameters of the project, after which, you can save the project with a correct name. You look to have tried this 22 times prior to this screen shot, you're in "untitled23" for your project name.

Preview tab is not visible in Android Studio

I have installed an android studio and tried to create my first project. But preview tab is not visible.
I checked it in the View -> Tools Window but the preview is also not present there.
Even Design/Text tab is not visible in the android studio. I checked the earlier posts in stackoverflow but have not been able to resolve this problem.
Like this one : Where is Android Studio layout preview?
Not able to show you the image as this is my first question and I have only 1 reputation. :(
Please suggest a way to find it.
Thanks in advance
As per the screenshot your project structure is not as per it should be. Reason is clearly visible in the picture, Your SDK buttons in tool bar are grayed in screen shot that means there is some problem in the SDK path.
please set your SDK path from
File > Project Structure > Android SDK
And after that sync your project with gradle using the tiny gradle button available in tool bar.
Not even the preview, you will not see any android specific tabs if your sdk path is not correct.
For reference your studio will look like this after correct sdk
I had the problem of not seeing a preview tab, or the design and text tab. After playing around with it for a while I found that the problem was that my Gradle was messed up. I went to the Gradle Console (bottom right corner of the screen) and opened it. I asked me to import Gradle project (the one I was working on) and it worked. Sorry if that doesn't make sense, I am very new to Android Studio

How to open android documentation and samples of code in android studio

I have downloaded all documentation with SDK manager help. But how can I open this documentation and the samples of code in Android Studio after downloading?
According to Android Studio Tips and Tricks, you can press Ctrl+Q to show docs for selected API under Windows or F1 under Mac.
For the samples , you can use eclipse to export to Android Studio.
First you need to make sure the documentation is added to Android Studio.
Go to File -> Project Structure. Under the Platform Settings heading, add or select an Android Platform. Go to the Documentation Paths tab and make sure the path to your SDK's documenation folder is added there - it should be [SDK]\docs\reference, where [SDK] is the full path to your SDK installation. If it is not there add it manually.
Once this is done, use Ctrl+F1 while your cursor is on the item you want to display help for.
The samples have not been ported to Android Studio yet, but I'm sure google will get around to it at some point. For now follow the instructions in the comments by androidika (you will need a copy of Eclipse installed).
In Android Studio you need to download javadoc dependency which is part of sdk.
If you enable documentation to appear while writing code in android studio by navigating to
File-> Settings-> Editor-> General-> Other
and
selecting(check box) Show Quick documentation on mouse move, you would get irritating after some time because it will come out automatically you when you would be writing code.
So, I think we should go to alternative ways by using Ctrl + Q(on Ubuntu at least I am not sure of other environments). This way when you would feel help you can simply use the simple command.
I was trying to find this setting in the latest build of android studio, and after wasting a lot of time I finally found out that now the ide automatically finds the documentation, which can be opened with shift+f1 on a method.
Now a days once you Import project in Android studio, it will automatically shows docs. But on mouse hover you want to expand it.
Docs hover page was simply resized very short like the above, it looks like docs is not avail. But when I Carefully moving the mouse down to the bottom of the hover page allowed me to resize it.

Is this a built in drawable?

In this linked image , I see the button on the right quite often in a lot of apps. On my Moto Droid, it is used extensively in the settings app. It is also used as the default AlertDialog icon. Can I use this via a android.r.drawable?
The icon is built-in with the Android development, you can access the image by using R.drawable.ic_dialog_menu_generic
While it may be possible to use it via android.R.drawable, you may want to find the image in the resources that come with your SDK ($ANDROID_HOME/platforms/$VERSION/data/res, where $ANDROID_HOME is where you have the SDK installed and $VERSION is a relevant Android API level). So, per Mr. Forloney's answer, you'll find that in, say, drawable-hdpi/ic_dialog_menu_generic.png in the aforementioned directory. Then, copy that image into your project. While it will add 5K to your project size, it will mean that the icon does not change based upon OEM or Android changes.

Categories

Resources