This is the folder with all the icon files
Now in my manifest, I'm not sure how to go about adding these icons.
android:icon="#drawable/"
Not sure what to put =/
I've tried putting #drawable/ic_mood_black_48dp and it still doesn't work
Put
android:icon="#drawable/ic_mood_black_48dp"
Those folders are for different resolution screens, and the appropriate png will be automatically shown based on device resolution. The name remains same for all of them, so this should be enough.
Android Studio should autocomplete your typing in the manifest as you type it:
android:icon="#drawable/ic_mood_black_48dp"
I had to move all the drawable folders outside of the folder 'drawable'.
Related
In my project I want to add a menu bar. I have downloaded a menu icon now I want to add it under .Android -> Resources. Unfortunately I can't add anything (a prohibition sign appears as a mouse icon). I also tried to add only a png or another file which also does not work.
My project
The downloaded icons:
Does anyone know how I can add the files in the appropriate place?
Don't know if this is the case, but some times the projects lacks the actual 'Drawable' folder. Create the folder yourself from fileexlorer
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
I'm brand new both to Xamarin and the Rider IDE, but not to Android. I'm going through some test projects, but when I make a new project, the ProjectName/Resources folder is missing things that I would expect to be there, most notably drawable. How can I create or get access to those directories so that I can do something like set the app icon?
I've tried creating a drawable directory, including it, and making sure that the build action is set to AndroidResource, but when I add Icon = #drawable/icon.png in the MainActivity, it doesn't recognize the drawable tag.
I found a solution for this. As I mentioned, I created the drawable folder manually, added the icon to it and made sure to right click and Include it. Then, in the manifest, I added android:icon="#drawable/icon and that got the icon to show up properly. So it didn't fix the issue of the folders not being generated, but at least for a simple task like updating the icon, it worked.
You can also declare in xaml.cs file, in your xaml form constructor the following:
x:Name_of_your_image/icon.ImageSource = (FileImageSource) ImageSource.FromFile("image/icon_name");
This way you won't need the drawable folders, as it will automatically provide the source of the image.
How to change launcher icon of android app during run time?
I am getting icon from server and want to change it dynamically.
In shortcut icon its working but menu icon is not changing.
This may be a duplicate question:
Basically it should be impossible but there is a possible workaround. You can change your manifest to point at multiple drawables.
Create multiple activity-alias tags in Manifest for your MAIN
launcher activity and give a different icon drawable to it. You can
then choose a particular activity-alias via your code as per your
requirement.
Open your android studio as an android application go to res folder inside res folder one folder mipmap. Inside mipmap two folders are showing ic_launcher and ic_launcher_round. Replace with your desired icon of your application and rename your desired icon as ic_launcher.png.
Path=Android project>res>mipmap>ic_launcher and ic_launcher_round > put/replace your desired icon in both folder after renaming abc.png to ic_launcher.png and abc.png to ic_launcher_round.png. You can find the location from manifest file from the mentioned line> android:icon="#mipmap/ic_launcher" . Press ctrl+(mouse click) you will reach to same location. Change your desired icon and enjoy.
my problem is that in version 4.2 the background in LinearLayout not showing, but in previous version it showing. I put the background like this:
android:background="#drawable/image"
I don't understand why.
I was just having the exact same problem. What fixed it for me was making sure I had the proper versions in the proper drawable-xxxx folder. For example...
If your image is in res/drawable but not in any other folder like res/drawable-hdpi, res/drawable-xhdpi, etc make sure you create a version appropriate for each of the screen sizes you are supporting and include that version in the corresponding drawable folder.
After I did that my bg drawable started showing up.
maybe it helps someone..I had a problem too with version 4.1.1 and everything I do was to set background programmatically
myLayout.setBackground(yourDrawable);
There isn't any problem with the syntax you are using. May be you are having some other problem. My advice would be to-
Try cleaning the project and run it again.
Check if you have the image named 'image.xxx' in your drawable folder.
Check if you are setting background of the correct layout.
or perhaps you can post some more code so that we can answer you more specifically.
Adding to the Above answer, check that the name of the image in drawable folder is in lower-case. All the drawables must have lower-case names.