I have a problem in changing the image background in Android using Eclipse.. I already replaced the previous image but then when the emulator run it always appears the replaced image.Pls help to solve this.Thanks
So what you are saying is that even after you replaced the images those images are still shown. Make sure that you replaced the previous images in all of the drawable folders. Because if you just replaced the drawable-hdi images but not the drawable-mdpi ones than if the emulator or device has a mdpi screen it will load the mdpi images from the drawable-mdpi folder thus showing the older images. So make sure you replaced all the images and not just in one folder.
Simply add android:background="#drawable/backgroundmenu" in your Layout section in XML activity
But first, import an image called "backgroundmenu" in drawable.
you need to clear your files in drawble folder in this location; ..\eclipse\workspaces\YourProjectName\bin\res\crunch\drawable
clear all files there, good luck!
Related
Instead of using multiple images of multiple sizes in different folders like mdpi,ldpi,hdpi etc, can i put single image in drawable folder for app launcher icon so that i can reduce app size. What should i do for that.
Probably, try changing your manifest from the mipmap directory to the drawable one. If it doesn't work, I suggest just using a mipmap version with all the different sizes. If you think preparing the different icon sizes is difficult, it's not:
When you add the launcher icon, android studio will offer you to auto generated the various densities for you while you're in the image selection bit. So, you only have to add one image, incase you thought you had to resize them.
Its simple,generate icon of largest size ,which u think u may need anywhere ,and put that in your drawable folder. Android will automatically resize and use it according to requirement , This way you can effectively have just one image and let android handle sizing
My ImageButton in my app is very tiny and cut off. I realized this could be because the image was in the drawable folder instead of the mitmap folders. So, I copied the images from the drawable folder, and pasted them in mitmap folders. Now, should I go about deleting the image from the drawable folder? I get the following saying it is not safe:
I know how to access the images, but should I delete them from the drawable folder now that I have already moved them to the mitmaps? If I do a delete anyway, will I need to alter my code to access the mitmap image? What is safest to do?
Here is an image of my mitmaps:
Thanks for the expert advice,
Rich
"Not safe" in this context just means that it's still being used somewhere. If you delete it, the current usage will fail to compile, and you'll be easily able to find and alter it to point at the new location.
You can safely delete this image, in Android Studio if you are using this image or else the file will be open at some place, you can get this error actually, so try deleting this image will safely remove the only selected image into your workspace. So hassle free to delete it.
After deleting your image, clear your project and run it, it works fine.
The mipmap folder is used for image that are very small and should be used in the action bar, and other menus. If you find your image too tiny, it just will be worst if you put it in the mipmap folder. If it's tiny although the image is in the drawable folder, maybe the image has a very small dimension or your imageview is too small.
When i copy-paste an image to the drawable file, i get one image with the original resolution. When i use the New--ImageAset way i get a lot of images for different screen densities but they are all blurry, even xxhdpi! How can i have the different densities inages without this problem?
Im surprise i didnt noticed it before!
I read this but it hasnt helped me
Android ImageView blurry?
http://developer.android.com/guide/practices/screens_support.html
Any advice am i doing it wrong?
EDIT
I tried the AndroidAssetStudio but it still happens
Before
After (xxhdpi)
Cant i get it to be the ldpi and then make it scale up from it or something?
You can create your image in different resolutions using Android Assets Studio. Then, copy paste the image to the respective folder. This will give you a proper image, without blur.
There is a plugin exactly made for the same purpose. You can use that plugin to make different sizes of the same image. You have to copy/paste a single image in drawable folder. Then right click drawable folder and select
NEW>Batch_Drawable_Import. Select the size for your image and it will itself make the other sized images for you.
I need to get same images with same name, but in different resolution. So i created different drawable folder for every resolution and having images with same name in all folder. But when i am running this aap at that time some images coming dynamically at diff resolution. I have to bound images, should comes from related resolution folder at which device it is running at that moment. I used some images as theme, these are making trouble for me. :( :(
I created drawable folder in this way.
drawable-sw600dp-land-mdpi.
drawable-sw600dp-port-mdpi.
Please help me, I am indeed.
If your folders are named correctly, android will take care of that by hisself. If the device is rotated, the activity is destroyed and recreated again. Depending on on current state (landscape or portrait), android loads the drawable from the corresponding folder and you only have to say "load a drawable" :)
If the corresponding folder doesnt exist, android falls back to a default one.
Try to change
"drawable-sw600dp-land-mdpi" to "drawable-sw600dp-land"
"drawable-sw600dp-port-mdpi" to "drawable-sw600dp-port".
Remove "mdpi" from directory names.
create drawable folder like this
drwable-land-mdpi
drawable-port-mdpi
drwable-land-hdpi
drawable-port-hdpi
and also see this link google resources
I have a state file for buttons which worked fine until I put drawables into res/drawable-mdpi.
I had only drawable in res/drawable-hdpi but I want the app to work on all displays.
The state file is placed in res/drawable as I read it on some websites.
That way it is also done by google with the standard drawables but Ecplise keeps telling me that it can't find drawable with value #drawable/button_normal.
The drawables are definitely at their places.
So what am I doing wrong here?
Ok...there was nothing wrong with the code, drawables were not ok.
I made them again, 9-patched them and voilĂ : no comments by eclipse.
Sorry for wasting place for this.
make a folder drawable inside res and put ya pics into that folder. and you can refer to them as
android:background="#drawable/oscar"