I want to have an image show up in my Android application, but it always comes out blurry. What do I do? My image is 10000x11866 pixels, and I've made it big on purpose so that it wouldn't come out blurry, but it still does.
Here's my approach: right click the 'res' folder -> new image asset -> set icon type to 'action bar and tab icons'
What am I doing wrong?
Action bar and tab icons are much smaller than that, so the wizard is scaling down the image. Do not use the Image Asset Wizard for your image.
Instead, create a drawable-nodpi directory under your existing res directory in your module's main source set. Then, copy the image into that drawable-nodpi directory.
Note that you may run out of memory with an image that size, and there is no Android device with a screen resolution anywhere near that. I recommend that you reduce the resolution to something more reasonable, such as 1000x1186.
You can just copy the image and paste it in the drawable folder. Make sure the name of the image is in lowercase.
Also, make the dimensions smaller. There is no need for the picture to have such extreme dimensions. Especially if the image is not being zoomed. 1920 x 1080 1000 x 1000 are big enough trust me.
Post your code so we can see what's going on.
Related
When you code on Android Studio there is a standard icon symbol ( green Android ). I know how to change it. When I go to manifests.xml and look at this line
android:icon="#mipmap/ic_launcher"
the icon launcher must be in the directory "mipmap". When I go to mipmap, there are several .png files of ic_launcher.
Such as
ic_launcher.png(hdpi)
ic_launcher.png(mdpi)
ic_launcher.png(xhdpi)
ic_launcher.png(xxhdpi)
ic_launcher.png(xxxhdpi)
The question now is which of these files do I have to replace in order to get a new custom icon? Thank you.
You should use the Image Asset wizard. This allows you to add an Image Launcher which is the kind of image for your App's logo
Image Asset Pop-up Menu
Image Asset will ensure all resolutions and sizes for the logo.
They are categorized according to the size of screen for example tablet users uses xxhdi ic_launcher.png and hdpi ic_launcher.png for small size screen like 3 inches screen. If you are developing cool apps then you need to resize your icons for all these mentions size otherwise you can make any size and call them in manifest.
All of them because each one of them means that the icon will be displayed on the device depending on the size of the screen that is "from the smallest to the largest".
A tip if you are going to use the same icon for each one, first create the bigger image and then reduce it, I think the same android studio is reduced when you use the option because of the icon I think you can call application icon.
The biggest image is 512, this is the image of the web that will be displayed in the Play Store
So whenever I import an image as an image asset it is always blurry. When asked what type of asset is it I always select launcher. (Because thats the only way.)
I'm using the drawable as part of a selector, one image when pressed and another when not. Is there another way I can put an image in android studio?
Use Draw 9-patch tool to create bitmap images that automatically resize to accommodate the contents of the view and the size of the screen.
You can get this tool from your Android SDK sdk/tools directory
http://developer.android.com/tools/help/draw9patch.html
Note : I You want to put image according to device resolution add your image to these folders hdpi, xhdpi ,xxhdpi
You can put images in Mipmap of all the resolution in different folder like hdpi, xhdpi ,xxhdpi and you can use it
I'm developing the splash screen for an Android application and I wanted to simply put an image designed in Photoshop as a background. The problem is that when I save the image its resolution is 1080 x 1920, but when I add it as a drawable in Android Studio, it gives me the error "Bitmap too large..." and says that the resolution is 3240 x 5760 (exactly 3 times bigger). I can't figure out why this happens, can you please help me?
Thanks
drawable folder in Android actually represents drawable-mdpi folder.
If you put images in drawable folder they will be upscaled in devices with higher dpi. That is why you are getting larger image.
Put your image in drawable-nodpi folder to prevent automatic up or down scaling of images.
you can also use this http://nsimage.brosteins.com/ link.
Go to Upload an image and a zip file will be downloaded containing 6 drawable files.
Extract files and copy those 6 folders in : \app\src\main\res.
I need to add an image as an Activity Background so.
I right clicked res folder > New > Image Asset
and I imported a picture under Launcher Icons category. But my pictures have been resized and the quality has been lost. Is there anyway of importing the original image and its quality without having to resize it through Android Studio?
Also, how would I reference it in my XML? I'm used to eclipse and what I usually do is:
android:src="#drawable/MyPicture"
ALSO, How would this affect screen sizes since I'm avoiding resizing? The original image size 900 x 678
You are importing them, as you said, under Launcher Icons category, which will automatically try to resize them to 48dp (and the respective px for the resolution density). You probably just want to navigate to your project and copy paste the image into the drawable folder and then refer to it as you mentioned in your question.
android:src="#drawable/MyPicture"
Your other option is to create different sized backgrounds and copy paste them into their respective drawable-mdpi, drawable-hdpi, drawable-xhdpi, drawable-xxhdpi, and drawable-xxxhdpi folders.
Android will try to scale your image to fit the screen unless you specify a scaleType: http://developer.android.com/reference/android/widget/ImageView.ScaleType.html
So, I am just a beginner and I already went trough android documentations about supporting different screen sizes and I understand most of it.
For my app, I created different layouts for each screen sizes and on the emulator it looks good.
Just one question.
How should I export images to my drawable hdpi.lpdi,...mdpi...folders?
Because, What I did was, I used art text2, and created a project with 700x700. Well. I set it to transperant, so it's not excatly 700x700px. cause the image does not fill the entire space.
So, before I hit export, should I change the PX Resolution for example for 450x450 or something for mdpi? But, I didn't do that, and I amnot sure if I should have done that. then i hit export and it asks me where i want it to save the image. It also gives the me option to the change the DPI Resolution in DPI, i changed to 160 and saved that in my drawable/mdpi folder. But I did not change PIXEL resoultion.
So, was it correnct? or should I have changed the pixel resoultion before, I export the actual image?
In Eclipse, However, I change the width and height of the image in dp not px. so it doesn't take the entire screen space.
I checked my app on different screen sizes in Eclipse and it looks awesome. But, in the emulator, it looks cool. HOWEVER, if open my hdpi emulator the image does not look very sharp or clear. What's the problem?
The image itself looks clear and sharp if open it with my image viewer on my computer even, the image viewer window is almost taking the entire screen of my laptop (14,1280*800).
I will suggeset you to use 9patch image. you can create 9patch image using android tool called draw9patch Located in sdk/tools.What you have to, create a high resolution image and then give to draw9patch tool it create image with extension .9.png and use that image
See the link for detail
http://developer.android.com/tools/help/draw9patch.html
Okay if i understood right, then you need to have 4 res for each image, and the aspect ratio will be "1:1.5:2:3" and some times "1:1.5:2:3:4" so you have to get all the images that you need in 3 or 4 sizes and let the android os properties do its magic by choosing the right picture based on the screen size.