imageview

Android PhotoView Keep Zoom After Orientation Change

核能气质少年 提交于 2019-12-18 03:39:15
问题 I am utilizing the PhotoView class by Chris Banes to be able to zoom into an image and see it, but I want to make it so that when I change the orientation, the photo will still be zoomed in after the change. I understand the basics of how to do this, that when an orientation change is detected, onSaveInstanceState will be called, so I'm trying to save the instance in there, and then put it back into the PhotoView when onCreate is called. public class MainActivity extends ActionBarActivity {

Android: how to detect touch location on ImageView if the image view is scaled by matrix?

試著忘記壹切 提交于 2019-12-17 23:44:13
问题 I set OnTouchListener of an ImageView and implement onTouch method, but if the image is scaled using matrix, how do I calculate the location of the touch? Or does the motion event automatically takes that into account when returning getX() and getY() ? 回答1: getX and getY will return the touch location in the ImageView's coordinate system. If you're looking for the point within the image's coordinate system, you can use the inverse matrix of the matrix used by the ImageView. I've done

ImageView with rounded corners and inner shadow

倾然丶 夕夏残阳落幕 提交于 2019-12-17 21:57:25
问题 I need to make a thumbnail view with rounded corners and inner shadow. Usually I'm making ImageView frames with 9patches, which have served me well so far, but this time the effect I need requires drawing the inner shadow on top of the image (and not just around it). This lead me to extend the ImageView class and override the onDraw() method. public class ThumbnailImageView extends ImageView { After many tutorials (thanks StackOverflow!), I ended up with this code for the onDraw() method:

add image to surface view in android

僤鯓⒐⒋嵵緔 提交于 2019-12-17 18:44:31
问题 I want to add image to Surface view. So i used below code public class MySurfaceView extends SurfaceView implements SurfaceHolder.Callback{ Bitmap myicon; Canvas canvas; private Paint mBitmapPaint; Paint p= new Paint(); @Override protected void onDraw(Canvas canvas) { Bitmap myicon=BitmapFactory.decodeResource(getResources(),R.drawable.icon); canvas.drawColor(Color.BLACK); canvas.drawBitmap(myicon, 0,0, p); // canvas.drawBitmap(myicon, 0,0, null); // canvas.drawBitmap(myicon, 25,25, null); }

how to use correct dragging of a view on android

时间秒杀一切 提交于 2019-12-17 18:44:24
问题 it seems that there are a lot of solutions of how to use dragging of views on android . however, they are either too slow or buggy. a known solution is to have a framelayout , and the view simply changes its layoutParams as it moves using the OnTouchListener ,as described here: http://www.anddev.org/novice-tutorials-f8/android-drag-and-drop-of-normal-views-not-bitmaps-t13404.html however, if the view is an imageView , when reaching the most right (or most bottom) side of the framelayout , the

android programmatically blur imageview drawable

北慕城南 提交于 2019-12-17 17:59:06
问题 I want to programmatically blur and unblur images in Android. I hear that android flag "blur" is no longer supported after API 14 , but I wanted to use Java methods anyway. My main problem is manipulating the bitmap from an Imageview drawable. How would I get the bitmap from an imageview and manipulate it (will probably use gaussian blur) and set it back to the imageview? I think the process involves extracting the drawable, converting the drawable to a bitmap, doing my blur method on that

How to get the height and width of an ImageView/Bitmap in Android

天涯浪子 提交于 2019-12-17 17:44:44
问题 I want to get the height and width of an image bitmap that is either in ImageView or a background image. Please help me, any help will be appreciated. 回答1: You can get height and width of ImageView by using getWidth() and getHeight() through while this will not give you the exact width and height of the image, for getting the Image width height first you need to get the drawable as background then convert drawable to BitmapDrawable to get the image as Bitmap from that you can get the width

Set visibility of progress bar gone on completion of image loading using Glide library

依然范特西╮ 提交于 2019-12-17 17:34:19
问题 Hi I want to have a progress bar for image which will shown while image loading but when image loading will be completed I want to set it to gone. Earlier I was using Picasso library for this. But I don't know how to use it with Glide library. I have idea that some resource ready function is there but I don't know how to use it. Can anyone help me? Code for Picasso Library Picasso.with(mcontext).load(imgLinkArray.get(position).mUrlLink) .into(imageView, new Callback() { @Override public void

How can I load Computer Directory images in JAVAFX

与世无争的帅哥 提交于 2019-12-17 16:43:05
问题 I am trying to load my computer folder images into a wall of thumbnails. I read on a thread from another forum that ImageView "url" instance variable does not support system paths. I tried with the solution there, but it throws an exception: java.lang.OutOfMemoryError: Java heap space as it keeps reading the file . another problem is it keeps giving me warning of using package javafx.ext -> SwingUtils.toFXImage method. I have also tried to input the URL like that: "file://localhost//Users

Deep copy of a Drawable

谁说胖子不能爱 提交于 2019-12-17 16:32:43
问题 I have an ImageView. In its onClick I get its Drawable: Drawable dr = ((ImageView) v).getDrawable(); And set it to a dialog's ImageView: zoomedImage.setImageDrawable(dr); But when I close the dialog or the activity is resumed. The image at the original position gets stretched and is shown larger than its size, leading to only a portion of the image is visible in the ImageView. Is this a case of deep copy or there is another problem? If it is, how can do I deep copy the original Drawable so