drawable

Android: How to get Drawable Image name

余生长醉 提交于 2019-11-28 01:59:16
I want to get the name of the drawable image and want to store that name in a string. For example , for an Image, I might use a .png file named play.png or stop.png. I just want to know which image in drawable is used for the ImageView.. Is there any way to get the name of the drawable/(??.png) Thanks. I donot think there is any direct way to get name of drawable image unless you stores the image name along with image. In XML you can do the following to set image name as an additional data to imageview android:tag="btful.png" Programmetically setting imagename ImageView img = (ImageView)

Resize your image according to screen sizes?

瘦欲@ 提交于 2019-11-28 01:52:16
问题 I noticed that whenever I tested my app on my Droid X and Droid Bionic, the images where actually fine. But whenever I tested it on Larger devices such as Android Tablet. The image is kinda stretched. I also have a question about the information below, I tried to make 4 copies of "my_layout.xml" and store it in "layout,layout-small,layout-xlarge,layout-xlarge-land" folders. Each of them contain different sizes of the image. That one did the work, they all look good in any sizes of screen

How to check if ImageView contains Bitmap or not?

ぐ巨炮叔叔 提交于 2019-11-28 01:28:56
问题 I am implementing if a ImageView has bitmap then it should save the image from imageview to internal memory ,otherwise set another bitmap in internal memory of application. here is code:_ croppedImage = cropImageView.getCroppedImage(); croppedImageView = (ImageView) findViewById(R.id.croppedImageView); croppedImageView.setImageBitmap(croppedImage);@Override public void onClick(View v) { // TODO Auto-generated method stub switch (v.getId()) { case R.id.btn_save: counter++; if(croppedImageView

Why does BitmapFactory.decodeResource scale my image?

那年仲夏 提交于 2019-11-28 01:27:02
I have an image that is 120x120px located in my /res/drawable/ directory. This is the size required for all devices. To load this Bitmap, I am using the following: Bitmap tmpBmp = BitmapFactory.decodeResource(getResources(), R.drawable.myimage); The issue is that when I measure tmpBmp , the size is 360x360px. I know how to scale this back down to the 120x120 that I need, but it is a waste of processing time, although minimal. I am assuming that this has something to do with screen densities, since my resource is in a density-less directory. What is the reason for decodeResource scaling my

Android Studio Error: org.gradle.process.internal.ExecException

北城以北 提交于 2019-11-28 00:01:52
问题 I am new to android development and have hit my first error and can't seem to get around it. I have downloaded and installed android studio and java on my mac and a made a dummy app just to see it run in the simulator. The default hello world app runs fine but as soon as I add a .png file to my drawable folder, I get this error: Error:Error: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Users/billy/Library/Android/sdk/build

Repeat drawable in imageview?

风格不统一 提交于 2019-11-27 23:36:50
问题 Is it possible to repeat a drawable in an ImageView? I manage to repeat my drawable as a divider in a ListView, but not as an ImageView. Here is my repeated image definition: <bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:src="@drawable/xdividerrepeat" android:tileMode="repeat"/> Thanks Markus 回答1: You could use a "dummy" view like a LinearLayout to accomplish this. Just create a LinearLayout with the size you need and set its background drawable to be your

How to place pin mark image over an image in android?

血红的双手。 提交于 2019-11-27 23:16:39
I am new to Android. I am developing a project where I will get the Radio signal values(I can get the values from API). I have a floor plan. The floor plan has kitchen,hall,bedroom sections.. If I click the Kitchen section, I need to place an Pin Image in that section with Radio signal values. Once I click Save, I need to lock the Image(with values) in that particular section. Similarly I can place many Pin images based on the requirement. Please give me some related link or sample codes to develop this. I have attached the Image for your reference. Any help would be really appreciated. One

How to change color of drawable shapes in android

China☆狼群 提交于 2019-11-27 21:53:44
I am developing small android application in which I set drawable resource as background for linear layout. Now what I want to do change background color of linear layout dynamically, but within drawable resource. My code looks like : // bcd.xml <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape> <gradient android:endColor="#22000000" android:startColor="#22000000" android:angle="270" /> <stroke android:width="3dp" android:color="@color/white" /> <corners android:radius="3dp" /> <padding android:left="10dp" android:top="10dp" android:right="10dp" android:bottom

Android: Accessing images from assets/drawable folders

大憨熊 提交于 2019-11-27 21:07:20
The app I am currently working on has hundreds of images. At the moment I store them in the 'Drawable' folder. I was thinking about moving all of them to Assets folder. My question is: Is there any difference in performance when using both approaches? I don't think so there is bit difference in performance of using these two folders , I think using drawable folder you can get easily images (All will be indexed in the R file, which makes it much faster (and much easier!) to load them.), and If you want to use it from asset then you have to use AssetManager then using AssetFileDescriptor you

Android : Understanding drawable folder

自闭症网瘾萝莉.ら 提交于 2019-11-27 20:42:27
I have an image with dimensions 250*70 pixels under drawable folder (I'm just starting out in Android development, so i created drawable folder in res ) and I have the same image with higher dimensions in drawable-large folder; but the image is not looking as I expected. Can anyone explain the reason behind/purpose of 3 drawable folders? Where should I store my image so that it displays properly in both modes (landscape & portrait) and in all the mobiles (including tablets)? I want my image to scale dynamically to the size of the device screen. Can anyone share your views or links to search ?