Android :: Drawable Changes Sizes On Screen When Reading Image From File / Avoid This?
Apr 15, 2010
I have an image on a private file.
I read the file, create the drawable, and assign it to an ImageView.
The ImageView has WRAP_CONTENT so the size is automatic.
On 320x480 screens, the image looks good
But on screens with more resolution and high density 480x800 or 480x854 (N1, droid) , when the image is for example 150x150, I see the image as 100x100.
Of course it has something to do with the density but not sure how should I resolve this.
This is my code...
if I then inspect the size of the icon, android thinks the size is 100x100, when really is 150x150.
Looks like its reducing the image by the density.
Can anybody explain this and how to avoid this.
View 1 Replies
Apr 22, 2010
I've been reviewing the Supporting Multiple Screens documentation on the Android and I just need some additional clarification...
It's my understanding that designing three unique interfaces (ldpi, mdpi, and hdpi) would be the best way to go about supporting all the potential android screens with minimal scaling/distortion.
Yes, I know there are similar questions posted, however... If I create an image for the benchmark mdpi (let's say my image is 300x210, just for example) how to I determine what size I will need to recreate that image at ldpi & hdpi? This post as well as a google search leads me to believe that ldpi is just 75% of the mdpi image, and the hdpi is 150% of the mdpi image. Is this accurate?
View 1 Replies
View Related
Aug 12, 2010
With the many devices available, each with different screen density and resolution, I am wondering - how many versions of an image should I make for the different device screen sizes? Is it 3? small, medium, large or just 1.
View 4 Replies
View Related
Apr 13, 2010
I've read the Android documentation:
http://developer.android.com/guide/practices/screens_support.html
but still have some questions. I'm trying to design a music application which basically has images of the instrument (ImageButton) that play a sound when clicked. However, I'm confused about how to have the ImageButtons scale to fit all the different screen sizes and how to position them.
Which layout is best used for needing to position ImageButtons in specific locations on the screen? (i.e. cymbals on a drum set) FrameLayout, RelativeLayout? If I only really care about medium and large screens, do I need to create different resources (images) for both as well as a different XML layout to position them? I'm trying to find the simplest way to do this without having to create a separate layout XML file for positioning/size and separate image resources for each screen.
View 1 Replies
View Related
Oct 19, 2010
Is there a way to use an image size when setting the sizes of a view? I want to create a TextView item with the exact height of a resource image, but I don't want to use the image as a background for the text view.
View 1 Replies
View Related
Sep 28, 2010
For my design i have in the xml file something like:
The design is like a row that have two cells. I want one of them to be autosize and fill the row and one of them to have fixez size. I want that the second linearlayout to wrapp its content and the first one to fill the rest of the space.
Something like in css having two divs floating left and one having fixed size and one filling the rest of the row.
Is something like that possible using the xml file without changing the sizes manually?
View 1 Replies
View Related
Dec 14, 2013
A lot was made of Android 4.4 KitKat having a smaller file size than previous versions of Android. But for whatever reason I can find no mention of those actual file sizes, not even KitKat. How to know the file size of each version of Android?
View 2 Replies
View Related
Jan 9, 2010
hi, i run my application in an emulator/device automatically one drawable image other than default image i used my image coming for my application as background.how can avoid it?
View 1 Replies
View Related
Mar 16, 2010
I need to create a object Image from import javax.microedition.lcdui.Image; using a file .png placed in drawable folder. How can i do that?
View 1 Replies
View Related
May 1, 2010
I have the following drawable which draw a rectangle. Can you please tell me how can I add a 9patch image as the background of this drawable? code...
View 1 Replies
View Related
Nov 2, 2010
i am implementing puzzle game application in this application create one button in click the button display original image of the puzzle .original image display in dialog box then click ok return in to actual page how can implemented.
View 2 Replies
View Related
Sep 9, 2009
On a layout I want to scale the background image (keeping its aspect ratio) to the space allocated when the page gets created. I am using layout.setBackgroundDrawable() and am using a BitmapDrawable to setGravity for clipping and filling, but don't see any option for scaling.
View 2 Replies
View Related
Sep 9, 2009
On a layout I want to scale the background image (keeping it's aspect ratio) to the space allocated when the page gets created. Anyone have any idea how to do this?
I am using layout.setBackgroundDrawable() and am using a BitmapDrawable to setGravity for clipping and filling, but don't see any option for scaling.
View 4 Replies
View Related
Nov 1, 2010
A number of images are "built in" to my app. They are stored in the drawable folder. I'd like to give the option of sending one of these images via mms (or even email) to someone in the user's address book. All the examples I've seen are sending images that are stored somewhere other then the default Eclipse drawable folders.
View 1 Replies
View Related
Nov 13, 2009
I've got a quick question about screen size support. Currently, I've got an application that is rockin' along just fine on 1.5 and 1.6. Today the client called and says they want to run on Droid. While I've downloaded the 2.0 SDK, I'm a little wary of compiling against it. Will it break 1.5 and 1.6 compatilbility? How will the "medium" phones (G1, MyTouch) know to use those layouts?
View 3 Replies
View Related
Mar 17, 2010
I have a picture in res/drawable directory: res/drawable/picture.jpeg.
Can I dynamically update this picture.jpeg from code? i.e. I want to use another picture to replace this picture in the drawable directory dynamically. If I can, what path should I use to access the picture? Should I use "res/drawable/picture.jpeg"?
View 1 Replies
View Related
Nov 15, 2009
I have an app that I started in 1.6. It used images that were specific to portrait and landscape layouts. I put these in the corresponding drawable folders, for example:
drawable/image01,png
drawable-land/image01.png
when I created a new project with 2.0 it gave me the following folders. drawable drawable-hdpi drawable-mdpi drawable-lpdi. when I look at the documentation around these folders it all seems very straight forward. I assumed that you were able to create the following folders. drawable-hdpi-land drawable-mdpi-land drawable-lpdi-land
and everything would work as before. The image directory would swap automagically pulling the appropriately laid out image depending on your screen orientation. Unfortunately it does not. The SDK seems to get confused, and if I clean the project, the folders come up as poorly named.
View 3 Replies
View Related
Nov 11, 2010
I want to show image from drawable folder using path (res/drawable/icon.png). I do not want to use R.drawable.icon. Please anybody know how to view the image using res/drawable/icon.png.
View 6 Replies
View Related
May 2, 2010
I am trying to create a drawable in code and change the color based on some criteria. When I try and set the Drawable as the background of the ImageView it displays but won't let me set any padding. I realized I need to set the ImageView image via the setImageDrawable() function in order to be able to set the padding. The problem I am running into is that when I set it via the setImageDrawable() function nothing is displayed.
Here is what I have written:
<?xml version="1.0" encoding="utf-8"?>
ImageView icon = (ImageView) row.findViewById(R.id.icon);
ShapeDrawable mDrawable; int x = 0; int y = 0;
int width = 50; int height = 50;
float[] outerR = new float[] { 12, 12, 12, 12, 12, 12, 12, 12 };
mDrawable = new ShapeDrawable(new RoundRectShape(outerR, null, null));
mDrawable.setBounds(x, y+height, x + width, y);
switch(position){ case 0: mDrawable.getPaint().setColor(0xffff0000); //Red break;
case 1: mDrawable.getPaint().setColor(0xffff0000); //Red break;
case 2: mDrawable.getPaint().setColor(0xff00c000); //Green break;
case 3: mDrawable.getPaint().setColor(0xff00c000); //Green break;
case 4: mDrawable.getPaint().setColor(0xff0000ff); //Blue break;
case 5: mDrawable.getPaint().setColor(0xff0000ff); //Blue break;
case 6: mDrawable.getPaint().setColor(0xff696969); //Gray break;
case 7: mDrawable.getPaint().setColor(0xff696969); //Gray break;
case 8: mDrawable.getPaint().setColor(0xffffff00); //Yellow break;
case 9: mDrawable.getPaint().setColor(0xff8b4513); //Brown break;
case 10: mDrawable.getPaint().setColor(0xff8b4513); //Brown break;
case 11: mDrawable.getPaint().setColor(0xff8b4513); //Brown break;
case 12: mDrawable.getPaint().setColor(0xffa020f0); //Purple break;
case 13: mDrawable.getPaint().setColor(0xffff0000); //Red break;
case 14: mDrawable.getPaint().setColor(0xffffd700); //Gold break;
case 15: mDrawable.getPaint().setColor(0xffff6600); //Orange break;
} icon.setImageDrawable(mDrawable); icon.setPadding(5, 5, 5, 5);
This results in a space for the ImageView but no image.
View 1 Replies
View Related
Feb 11, 2010
I have to make a dedicated image viewer app for Android 2.x.
There are too many jpeg image files: about 2000~ jpegs, over 100MB.
I want access the image files with their file names,
but I couldn't find such an example.
By the way, is it okay to put many image files in /res/drawable folder?
I heard that the android application cannot be installed on sdcard and
the program repository is very small so 100MB app cannot be installed generally.
I found some examples which download the large data files on sdcard online,
but I cannot run a web server to host the data files,
and I must upload the fully packaged program on Android Market. (Should I build one apk file?)
What are the best practices for managing too many resource images (or something) in Android?
View 4 Replies
View Related
Mar 10, 2010
How can i convert a Bitmap to Drawable.
View 2 Replies
View Related
Oct 15, 2010
I want to develop an application for a tablet of 480*800 screen pixels. I had developed an application for normal mobiles, but now this screen size is large than normal size. what precaution should I take while developing the application? Because device is not available right now so I must have to work on the project using emulator.
View 2 Replies
View Related
Aug 25, 2009
G1, Dream, Magic, Hero, Galaxy and more to come... Does anybody have a rundown of their screen sizes (and of some of the devices to come out)?
View 2 Replies
View Related
Nov 29, 2009
Hello, I would like to ask what settings are necessary for my application to be available on all screen sizes: Is it enough to compile it using SDK 1.6 (but target is set to 1.5 and API level to 3) or maybe I have to set target to 1.6 and API level to 4?
View 4 Replies
View Related
Apr 27, 2010
supporting multiple screens (sizes and resolutions). I´ve searched not only this forum but many different websites and the android documentation but I´m probably doing a small mistake so things are not working properly.
Well, my main layout was designed with a HVGA screen, and it works great. When I try the same app on a WVGA, FWVGA, WQVGA or FWQVGA, I always get an unused space in the end of the layout because the screen ´s "heightnes" is proportionally bigger than HVGA´s.
So I consulted the documentation and decided to give a try on resource qualifiers, so I then created a nonsense UI and placed it on layout- large, created a new AVD using the WVGA skin and launched the app. Well, all I got was my old and not well stretched layout. The same happened to a FWVGA AVD.
This is the first problem. The second is: medium high density medium size screens and medium density large screens have the same resolution: how can I create a layout that is loaded for both, but not for (for example) medium size medium density or small size medium density screens?
View 10 Replies
View Related
Aug 27, 2010
I had write one application in that I am reading a image and sending it to the server, I am using Base64OutputStream class. I had tried it in core java and image is encoded successfully, But when I am using same logic in android then I am getting error as java.lang.VerifyError. And Logcat gives following error as............
View 4 Replies
View Related
Jun 2, 2010
I read about in the google documents that the 3 folders corresponds to different screen types and that android would select the image from different folders automatically according to the screen type. I read that WVGA will load from drawable-hdpi and HVGA will load from drawable-mdpi. When I tested with 2 emulators both running 2.1, each with HVGA and WVGA. It turns out that they are both reading the image in mdpi. If I deleted the image in mdpi then they read from hdpi. Can someone answer why emulator with WVGA is reading from drawable- mdpi?
View 4 Replies
View Related
Oct 16, 2009
How we can store image files(*.png) to the folder R.drawable at runtime?
View 2 Replies
View Related
Oct 20, 2011
Im making an app in which the user selects an image and then gets redirected to a new screen in which the drawable name is displayed.
This is the code triggered when the user click an image:
Code:
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
Intent tabsIntent = new Intent();
tabsIntent.setClassName("com.budisha.app", "com.budisha.app.TabClassActivity");
tabsIntent.putExtra("pic_name", position); //sends picture position
startActivity(tabsIntent);
}
This sends the new activity the drawable position. But i need to get the drawable name.
View 2 Replies
View Related
Jan 29, 2014
If I want to get an image from drawable folder I do this:
getResources().getDrawable(R.drawable.myimage)
But if I want to get an image in a folder like this:
drawable/pngs/myimage.png
How I can get that image?
View 9 Replies
View Related