Not have drawable-mdpi, drawable-hdpi, drawable-xhdpi, drawable-xxhdpi - android-studio

WorkSpace:Android Studio
I have 35 images.
I have realized that I have drawable (but not have "drawable-mdpi, drawable-xhdpi..") folder and also there are "mipmap-mdpi.." folders.
I put my images to the simple drawable folder. --> It gives me error: "Canvas trying to draw too large bitmap" I search little bit and I found "Canvas: trying to draw too large bitmap" when Android N Display Size set larger than Small that someone in the link said that I should move images to the "drawable-xhdpi" folder. I tried to move my images to the "mipmap-xhdpi" as you might be know I don't have any type of drawable folders. Only drawable I have.
I wanted to use "mipmap" folders for "Images." It works now but maybe it is not best practice
After that I have search it little bit and I found Mipmaps vs. drawable folders
and someone answered (878 up vote) that mipmap folders is for icons.
What Should I do?
Resize the images and put it back to the drawable
Do not move your images to the drawable again, it can stay in the mipmap folder no problem. The person in the link said wrong.
Thank you for your attention.
And very very important and last question is should i resize one image into 4 , and put one of them into mdpi, one of them hdpi, one of them xhdpi and one of them xxhdpi? if yes , it means if i have 30 images, i should resize and make it 120 images?

Related

Android Studio - Image asset without border

When I create a new image asset in Android Studio it has a white border on all four sides.
What setting should I use to avoid this ?
What I have done currently is to directly copy the images into drawable folder and use that image. This works but I don't get the flexibility of the multiple image that is generated when I use the create image asset.
If you are you speaking about this one:
Then all you can try to play with Shape, e.g.
BTW, there is Background parameter, too: you can choose any colour instead of white, if you wish.

Is it possible to clone/repack a sprite sheet with new images?

Here is an example scenario
Project A has a 2048x2048 sprite sheet and when unpacked, has 50 png images spread over the sprite sheet.
Project B is needed to be a clone, however, it has 50 DIFFERENT png images recreated in exact same dimensions and file names however they are different images.
Can you make it so that the new images appear in EXACTLY the same place as in Project A? And the resulting sprite sheet is exactly the same dimensions, just different images?
Chris
There is no difference, what size your spritesheet has. And what images contents. For your program it is just texture with description, that allows to create spriteframes with different parts of this texture and make them alias with spriteframe names. You can split your spritesheet(create two instead of one), change pictures, etc. The only thing that you can worry about is that all spriteframes should have the same names if you don't want to change the code of your project. Oh, and if you don't want to change positions, new spriteframes must have the same dimensions. As you mentioned, you've already followed these requirements, so you can feel free to use new spritesheet.

Change background of LWUIT Dialog

I am having trouble changing the background color of Dialog from white to any color.
I have tried the following code snippets but to no use.
dialog.getDialogStyle().setBgColor(0xffce78, true);
dialog.getUnselectedStyle().setBgImage(Image.createImage("/main_bg.png"));
dialog.getPressedStyle().setBgImage(Image.createImage("/main_bg.png"));
dialog.getSelectedStyle().setBgImage(Image.createImage("/main_bg.png"));
You need to use the dialog style getDialogStyle().
Regardless your code creates 3 separate yet identical images which is REALLY BAD! You are loading the same image 3 times into memory!
Is you image in the root directory? You should use the full path from the src folder, I mean, if your image is in the "images" package, you should put this path "/images/main_bg.png". If it is in the default package...."main_bg.png"

Create a sprite graphics from 400 graphics?

I need to create a sprite graphic, I hope that's the right name for it, to use that with jQuery to move that graphic from position to position to make it look like a gif animation.
As I have 400 graphics (all the same size) which should become one single image later, is there a way to create that sprite automated with Photoshop CS5 or any other Software?
So that it will create that sprite image from all my 400 pics?
I was searching for such a thing now for weeks ...
http://css-sprit.es/
This service might help you.
Also google "generate sprite"
Some css sprite generator are already available. Just upload your images and it will automatically give u the sprite image file and css for it.
http://spritegen.website-performance.org
http://www.csssprites.com
http://csssprites.org
You can use sprite-me. Just bookmark the link provided in the website than open your website and run sprite-me, it will automatically show images used in the website in groups and when clicking on generate sprite, you will get sprite image and css.
I found a little tutorial explaining how to create sprites. It might help you to write your own java program.
https://sites.google.com/site/javagamescorner/home/creating-sprites

how to make a Sprite

ive used an online srpite service http://spritegen.website-performance.org/ but i want to know how to make them by myself.
How can i save an image that it should be so small but when used on my web site it comes out normal size?
Sprites aren't about making the image itself small, it's about decreasing filesize by packing several images into one.
Take a look at Yahoo's icon sprite. Notice that they have all their section icons stacked vertically in one large image. They then use CSS to position the background to only show a small window of the sprite image, thus giving you just the icon.
In the end, it's up to you how you arrange your sprite. Check out the bottom of Amazon's sprite.
Either way, hopefully that helps gives you a better idea of the concept of sprites.
From the very site you link:
CSS sprites are a way to reduce the
number of HTTP requests made for image
resources referenced by your site.
Images are combined into one larger
image at defined X and Y coorindates.
Having assigned this generated image
to relevant page elements the
background-position CSS property can
then be used to shift the visible area
to the required component image.
So there is nothing magical involved: you simply need to pack all your pictures into a single giant image with your favourite graphics tool and insert them as CSS background. Just look at this CSS sprite by Google:

Resources