drawable

onCreateDrawableState never call

混江龙づ霸主 提交于 2019-12-08 22:10:04
问题 I have tye to add new state to RelativeLayout but onCreateDrawableState method is never call. My class is: public class UnreadableRelativeLayout extends RelativeLayout { private static final int[] STATE_UNREADED = {R.attr.state_unreaded}; private boolean isUnreaded = false; public UnreadableRelativeLayout(Context context) { super(context); } public UnreadableRelativeLayout(Context context, AttributeSet attrs) { super(context, attrs); } public UnreadableRelativeLayout(Context context,

Load big size image issue in imageview . Bitmap too large to be uploaded into a texture

非 Y 不嫁゛ 提交于 2019-12-08 20:38:26
问题 I have 270 x 2693 pixel image in drawable folder . When i try to set that image in imagview i got Bitmap too large to be uploaded into a texture warning. Image sets perfectly in android device < 4.0 but not sets > 4.0 device. Please help me to resolve this issue. Code <ImageView android:id="@+id/imageView" android:layout_width="fill_parent" android:layout_height="wrap_content" android:scaleType="fitXY" android:contentDescription="@string/name" android:src="@drawable/hindi" /> Here hindi is a

Serializing a Drawable object on Android

放肆的年华 提交于 2019-12-08 19:47:55
问题 I'm trying to speed up my ListView by cacheing the images and loading them from the phone rather than the internet when scrolling the list. However, I run into an exception when I try to serialize the Drawable object. This is my function: private void cacheImage(Drawable dr, Article a){ FileOutputStream fos; try { fos = openFileOutput(a.getArticleId().toString(), Context.MODE_PRIVATE); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(dr); oos.close(); } catch

Android - put an image name “package” throws compile time error

▼魔方 西西 提交于 2019-12-08 17:05:39
问题 I am trying to put an image name "package.png" in my drawable folder. As soon as i paste them it into the folder it is throwing following error: [2012-05-26 12:40:30 - MyApp] res/drawable-mdpi/package.png:0: error: invalid symbol: 'package' But as soon as i rename to some other name, this image works fine. Any idea why this is happening and how i can fix this and have a drawable named "package". 回答1: you cant do that, as it is a Reserved word. just like... break else new var case finally

Android Mipmap?

风格不统一 提交于 2019-12-08 16:12:43
问题 Whenever I try to generate a new Android project with AndroidStudio, it keeps hiding the folder "drawables". This has never happened to me before. I've been looking around and I've realized its been generating this folder called "mipmap". I searched around a little bit and I've found this is similar to drawables, but was this some big change in the new AndroidStudio release I missed?? If not how can I get my Drawables folder back? I've tried rebuilding my project, creating new projects and

android: how to add a customized image to widgets?

二次信任 提交于 2019-12-08 14:50:38
问题 i'm new to creating/altering images of any kind in android. what i'm trying to do is the following: i have a widget, that gets updated periodically from a broadcast receiver. thing is, i want to display a self-made (i.e. programmatically created) image in this widget. and i actually don't know how to ADD the image to the widgets layout. can anyone help me out? heres the code that updates the widget: public class MyReceiver extends BroadcastReceiver { @Override public void onReceive(Context

Change the tint of drawable in xml selector

半腔热情 提交于 2019-12-08 14:34:12
问题 I have a button with the background defined in xml. I would like to tint the button based on the current state it is in - ie - pressed, focussed, normal. Here is my xml file below. Also, my colored_tint_dark , and colored_tint are both translucent colors that I am trying to draw over the drawable image that I call from the resources folder. Here is the problem. When the UI first loads, the image has the appropriate tint on it, but after pressed, the pressed state doesn't show any tint, then

How to save image from drawable resource to sd card?

馋奶兔 提交于 2019-12-08 13:37:16
问题 So, i have a view like on the image below. Plus I will add a Save button. You can also see my XML file. I am using this code to load image from drawable folder by pressing the next and previous buttons: public void onClick(View v) { switch (v.getId()){ case R.id.bNext: a++; setImage(a); break; case R.id.bPrevious: if(a>0) { a--; setImage(a); break; } } } private void setImage(int a){ if (a == 0) { slika.setImageResource(R.drawable.l2); a = 1; } else if (a == 1) { slika.setImageResource(R

Rotating the phone causes memory out of memory

六眼飞鱼酱① 提交于 2019-12-08 13:16:52
问题 I have a very simple Activity that draws a drawable on another drawable in a Canvas and in the end shows it on a ImageView . I know that creating bitmaps takes too much memory and scale them down and I know about leaking by keeping reference to context, but can not detect where it happens. by now after 4-5 times rotating I get out of memory error. (I've specified that on code) Can you help me find where leak happens? here is my code: public class MainActivity extends Activity { @Override

Save Image from drawable to sdcard in camera activity

断了今生、忘了曾经 提交于 2019-12-08 13:07:17
问题 I'm working on a project, that read image file from drawable folder through ImageView, it loaded successfully through ImageView view = (ImageView) findViewById(R.id.imageView); view.setOnTouchListener(this); buttonTakePicture = (Button) findViewById(R.id.takepicture); buttonTakePicture.setOnClickListener(new Button.OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub camera.takePicture(myShutterCallback, myPictureCallback_RAW, myPictureCallback_JPG