Can't create a version specific values folder - android

This is what I see when I right click res>New Resource Directory. I've looked this up, and it's supposed to give me and option for a version. But I don't see it. I want to create a Values v-21 directory. Help will be great.

Scroll down and select as the qualifier, then specify the version, in this case 21. Note that in the screenshot it shows as selected but that's simply because the item you move to the right disappears when it's added to the chosen qualifiers

Related

I paste image inside the drawable folder in android studio 4.1 , it shows red lines (error line) in image name

This is my project folder, when i adding first image then it not show any error but after adding the 2nd and 3rd image it show the red lines.
I don't know where i do mistake, if anyone knows then please help me.
In Android Studio, click on View > Tool Windows > Resource Manager in the menus or click on the Resource Manager tab to the left of the Project window.
Click the + below Resource Manager, and select Import Drawables. This opens a file browser.
Make sure the name of the image you are trying to add does not resemble some keyword. I was trying to add an image in drawable with name "try". When i made it "tried" error went away. So, name your image != any keyword.
FOR YOUR CASE IN PARTICULAR:
Try invalidating cache and restarting it. Moreover, also check if the problem persists only with these two images or others too.
Names should be in lowercase.
Therefore never use names with uppercase letters in it
try removing numerals and keep a meaningful name. Also ensure that the names are in lower case
drawable folder is wrong place for png files.
In drawable are stored xml files
All png files should be stored in mipmap folders
If you want have only one png for all resolutions, store it in mipmap-anydpi
I found the problem.
Add the same image to the default drawable folder. Android Studio automatically doesn't add it to the default drawable folder.
It usually happen because of the name assigned to image file. try to put the name of file in snake_case.[error][solution]
solutionC.pngerror

My Android studio Drawable Resource Folder Imports in a very crowded manner

I'm currently following a tutorial, Currently, it is required to import multiple images drawable folders for different densities by simply copying and pasting it to android studio
picture of the Folder from which we import the images
Image of the tutorial after pasting
and This is Me after pasting
as you can see me pasting, Creates a directory for each image with the corresponding density
which makes the drawable folder very crowded, so am I doing something wrong ? or this is new in android studio ? because I remember an old project of mine which didn't import it like that, Thank you for your time and be patient with me
There is actually no problem. It is the view that you are using which is different. If you want yours to look like the on in the tutorial, you should go right to the top of that window (that shows you) and look for the android "face" or sign with the word "Android" next to it and an arrow pointing downwards and click on that android sign. A dropdown menu will open up and then you should choose the "Project" option option. Now your files will look like the ones in the tutorials.
Check this website if you are confused :
https://developer.android.com/studio/projects
You might be using Project View , try changing it to Android View.
You can find it on the top-left corner.

Android Development: Unable to create an icon #drawable/ic_action_search

I am new to Android Development. I was just following the basic turorial on developer.android.com to create my first application.
As I was creating the Action BAr, I had to add this Search button to it. I created the menu xml and this is what I had written on it.
<!-- Search, should appear as action button -->
<item android:id="#+id/action_search"
android:icon="#drawable/ic_action_search"
android:title="#string/action_search"
android:showAsAction="ifRoom" />
<!-- Settings, should always be in the overflow -->
<item android:id="#+id/action_settings"
android:title="#string/action_settings"
android:showAsAction="never" />
Now my question is on this part of the XML
android:icon="#drawable/ic_action_search"
I get a compilation error in eclipse, which says,
error: Error: No resource found that matches the given name (at 'icon' with value '#drawable/ic_action_search').
I checked on developer.android.com and also googled it out, but I'm just not able to locate a solution.
I need to solve this problem. As always, I am able to skip this part of the XML and what I get is just plain text "SEARCH", but the icon will definitely look better.
Here is the easy way if you're using Eclipse:
Ctrl+N (emacs keybindings) to open the file wizard
'File | New | Image Asset' in Android Studio
Select Android, "Android Icon Set"
Edit name ic_action_xx, click Next
Clipart, choose the icon you want
Select theme (Holo Light means a light background, Holo Dark means a dark background)
Eclipse will automatically populate the res/drawable-* directories with the new icon, scaled to the directory size. No need to download anything, understand PNG or copy the icon into multiple directories.
I use the file wizard A LOT.
In Android studio:
Right click the Drawable folder > Select New > Image Asset
(Alternatively, click shift, shift and type 'Image Asset")
In the dialog which popped up click 'OK'
From the wizard you can customise the asset you require.
Choose if it's a Notification icon, Action bar icon or launcher icon. You can select icons from clipart, create icon from text or import an image from disk.
The wizard will take care of creating different resolutions for your new image.
You need an image called ic_action_search.png or ic_action_search.gif, for example. Paste this image in every res/drawable folder.
As others have advised, you need to have (put) the icon graphic, "ic_action_search.png" in the correct folder, which is "/res/drawable" You may have to move a graphic file for one or more of the "drawable" subfolders of "/res"
You can find the icon graphics (and others that you will, presumably, need in the future) at, (http://developer.android.com/design/downloads/index.html#action-bar-icon-pack)
Please note: do not use the "Core Icons/unstyled," in the package. Use the "All_Icons/holo_light," (most likely) or "All_icons/holo_dark."
The error means that you don't have an image called ic_action_search in your drawable folder.
You can download an image for search from Android Asset Studio if you like.
I suppose you copy pasted some example code, as other answers says you missed putting drawable into your resources. For testing you might use default android search icon:
android:icon="#android:drawable/ic_menu_search"
I am not sure if it is safe to use it in release apps
First think English is no my main language, i apologize for my typing. Ok let's go to the problem. All this works for me, i hope it works for you. I was following the same instructions from developer.android.com as you, and it didn't say that you have
to put it in both .xml, or i didn't see.
Because is too much stuff and is overwhelming, i know at first but i hope to get used to it soon. Under the folder: res/menu you have two.xml archive one for the main page and the other for the activity. What do you have to do is copy that you wrote to both .xml archive:
Display_message.xml
main.xml
remember the action bar goes along the way with the activity, as many as you have. That means if you add another activity, you have to paste this in the new one in order to void that error. By the way you already have the images int he their respective folder. if not, it going to pop the error again. I hope this was understandable and with sense.
An other way to add a new icon into your project in Android Studio (same as dturvene's in Eclipse)
1. Choose drawable directory; Alt + Insert or File/New...
2. Choose "Image Asset"
3. Select drawable\hdpi as your icon's destination
4. An option window will pop up. Select directory to your icon saved in your PC.
I just found the way to do it so I hope it help.

Open source versions of Android phone icons

Are there open source versions of the standard Options, Home, Back, and Search icons that appear on every phone?
Check out this page, it offers a convenient way to browse the built-in drawables, most of which you can use just by referencing them in your layout.
See for example, the item ic_menu_home. You can probably use it in a layout like so
<android:Whatever
android:icon="#drawable/android:ic_menu_home"/>
Although, as the author of the page mentions, you sometimes have to copy items from the SDK resources folder if the above method throws an error.
Note also that while this method isn't guaranteed to match the icon you see, it will match what the user will see for that logical name. For example, I used this technique to add the "Preferences" icon to an options menu, and the emulator had a different icon than what was shown there. When you want a "standard" icon, this is good, although if you really wanted an exact image you could copy it into your app's res folder.

Adding a drawable resource

This must be something I’m just overlooking or possibly my ADT install is out of date.
When I attempt to add a new drawable resource to my project I don’t see a type of Drawable in the “New Android XML file dialog.”
Here’s what I see when adding a resource:
http://img221.imageshack.us/img221/2977/drawable.jpg
What am I missing here?
It appears to just be a bug in the plugin. When you first open the dialog the folder is set for "/res/drawable" but once you enter a filename it then complains "One of the types must be selected (e.g. layout, values, etc.)", but "drawable" is not one of the types in the radio box list!
So it's not even possible to put an empty file in the drawable directory (of course with the set of qualifiers that must be given in a set order for pixel density or language, etc).

Categories

Resources