imageview

Imageview skipped Frames

孤街醉人 提交于 2019-12-19 11:24:30
问题 i've got a Static Page in a Framework. My Navigation Drawer skip frames, when i'm loading the pictures the first time. Now just 3. Like that: -Title -Image (1000px x 350px, 50kb) -Text I want to use more Pictures in this Page but doens't think this will look good, because i have skipping Frames on the Nexus 4 and want this App to run also on Low End Devices. I set the Images in the XML-File. Is there a better way to do this? AsyncTask Got it myself. Hope i can help anybody with this Problem

why ImageView can't update before SystemClock.sleep()

走远了吗. 提交于 2019-12-19 11:06:11
问题 I want to show other image in ImageView within 3 second, after that rollover old image. The code: OnClickListener oc = new OnClickListener() { @Override public void onClick(View v) { ImageView iv = (ImageView)v; iv.setImageResource(img2_id); SystemClock.sleep(3000); iv.setImageResource(img1_id); } } myImageView.setOnClickListener(oc); But it doesn't work? So, am I doing something wrong? 回答1: You are blocking the UI thread. Thus during the sleep command, the screen won't refresh. What you need

why ImageView can't update before SystemClock.sleep()

≯℡__Kan透↙ 提交于 2019-12-19 11:06:07
问题 I want to show other image in ImageView within 3 second, after that rollover old image. The code: OnClickListener oc = new OnClickListener() { @Override public void onClick(View v) { ImageView iv = (ImageView)v; iv.setImageResource(img2_id); SystemClock.sleep(3000); iv.setImageResource(img1_id); } } myImageView.setOnClickListener(oc); But it doesn't work? So, am I doing something wrong? 回答1: You are blocking the UI thread. Thus during the sleep command, the screen won't refresh. What you need

How to make bitmap transparent?

让人想犯罪 __ 提交于 2019-12-19 09:47:52
问题 /** * @param bitmap * The source bitmap. * @param opacity * a value between 0 (completely transparent) and 255 (completely * opaque). * @return The opacity-adjusted bitmap. If the source bitmap is mutable it * will be adjusted and returned, otherwise a new bitmap is created. * Source : http://stackoverflow.com/questions/7392062/android- * semitransparent-bitmap-background-is-black/14858913#14858913 */ private Bitmap adjustOpacity(Bitmap bitmap, int opacity) { Bitmap mutableBitmap = bitmap

Load Image in ImageView from URL stored in JSONString in Android

允我心安 提交于 2019-12-19 09:15:17
问题 I have a JSON string, say a name and a Url . I need to extract name into the TextView and extract and display image in ImageView . Below is the code for above scenario. public static final String JSON_STRING="{\"WebImages\":{\"Imagename\":\"image_name\",\"imageurl\":http://www.example.com/image/example.png}}"; I need to display the name in TextView which I created, and fetch the image from that url and display in the Imageview . 回答1: First of all use Gson to parse Json and get url as a String

Picasso java.lang.IllegalStateException: Method call should not happen from the main thread

家住魔仙堡 提交于 2019-12-19 05:11:32
问题 I am attempting to use Picasso to get three Bitmap images from a URL public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.tab2); Drawable d1 = new BitmapDrawable(Picasso.with(Tab2.this).load(zestimateImg1).get()); } I am getting FATAL EXCEPTION with this code. I suspect it has to do with the fact that this should be done within AsyncTask , but I can't get it to work. If using that is avoidable, I would like to do this without using

Click listener for drawableleft in EditText in Android?

青春壹個敷衍的年華 提交于 2019-12-19 04:09:30
问题 Is it possible to add a OnClickListener to on a drawable that is declared in designer as drawableleft android:drawableLeft="@drawable/ic_password" Or is there any way to add a ImageView on the left side of that EditText 回答1: For drawableleft click listeners: editText.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { final int DRAWABLE_LEFT = 0; final int DRAWABLE_TOP = 1; final int DRAWABLE_RIGHT = 2; final int DRAWABLE_BOTTOM = 3; if

Android : How to set an image to an imageview from a url programatically

可紊 提交于 2019-12-19 03:18:20
问题 I have an image url coming from my rest API. Now I want to set it to an imageview when activity is loading. Below is how I get the bean from the rest api and then get the URL out of it. Message message=new Message(); String imageUrl=message.getImageUrl(); I get Message object from my database and image url is include in that Message object. Then I used Url object to get that image url. URL url = null; try { url = new URL(imageUrl); Bitmap bmp = BitmapFactory.decodeStream(url.openConnection()

Android rotate imageview, i cant set the final position of imageview in onAnimationEnd()

混江龙づ霸主 提交于 2019-12-18 21:53:12
问题 I want to rotate an imageview from 30 degrees on each click on a button. On the first clic, i can set the animation properly but i can't succeed to update the imageview position after the animation. When i clicked again on the button, the animation start from the original position of the imageview and not from the final position after the first animation. Here is my code : public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main);

Get Bitmap from ImageView loaded with Picasso

我们两清 提交于 2019-12-18 21:12:07
问题 I had a method that loads images, if the image has not been loaded before it will look for it on a server. Then it stores it in the apps file system. If it is in the file system it loads that image instead as that is much faster than pulling the images from the server. If you have loaded the image before without closing the app it will be stored in a static dictionary so that it can be reloaded without using up more memory, to avoid out of memory errors. This all worked fine until I started