imageview

Android: handling clicks on image view inside recycler's view item using touch framework

a 夏天 提交于 2019-12-01 02:09:45
I am trying to capture the clicks on ImageView which is enclosed inside the RecyclerView item. I have implemented RecyclerView.OnItemTouchListener and has gesture detector process the motion events for normal clicks and long press on RecyclerView item. Since I want to have the same touch framework to process touch event on child views inside the RecylcerView item, I have set View.OnTouchListener with the image view as well, overriding the onTouch implementation returning true hoping that the touch shall be consumed by the ImageView when it gets clicked. I am intentionally returning false in

Create an image-overlay mask in javafx

一个人想着一个人 提交于 2019-12-01 00:52:28
I'm trying to do a simple thing. I have a binary image and all I want is to overlay the binary image on a color image, but the white pixels in the binary image should be red, and the black transparent. I'm quite used to JavaFx but I'm stuck with this one. I know I could achieve it by iterating through all pixels with a PixelReader, but I'm sure there is an easier way. I tried to use some sort of Blend-effect but no luck so far. I think it should be similar to this: How to Blend two Image in javaFX I came up with this: Image image = new Image("/circle.jpg", false); ImageView iv = new ImageView

Can't use setForeground method on ImageView

荒凉一梦 提交于 2019-11-30 23:47:41
问题 I want to use the setForeground method to show a "play" icon in the center of my ImageView to indicate the user that a video will play if they press it. Currently I'm having this error which I cannot solve: Although the documentation says the method should be available since API 1: I'm targeting and compiling against API 23 with build tools version 23.0.1. I'm targeting min API 16. 回答1: That is a documentation bug. setForeground() existed on FrameLayout from API Level 1; it is only on View as

Click listener for drawableleft in EditText in Android?

ぃ、小莉子 提交于 2019-11-30 23:25:14
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 Ranjith Kumar 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(event.getRawX() <= (editText.getCompoundDrawables()[DRAWABLE_LEFT].getBounds().width())) { //

How to apply half circle mask to an ImageView

自作多情 提交于 2019-11-30 23:22:26
I have an image, a half circle frame image and I need to put that image inside this frame. But I need to apply mask to my image so it is only displayed inside frame. For example this is my image: And my desired result should be like that: The red frame also an image view which inside is transparent. How can I achieve this in Android? There's a great tutorial on Styling Android blog in four parts that explains how you can achieve this. Edit: I've edited the code in part two of the tutorial and created the effect: private Bitmap processImage(Bitmap bitmap) { Bitmap bmp; bmp = Bitmap.createBitmap

implement GestureDetector for an ImageView

ε祈祈猫儿з 提交于 2019-11-30 23:13:32
Good moorning : I have an ImageView in my Activity and I setted the OntOuchListner() to my ImageView, which means that I implemented that interface for my ImageView like this : public class mapActivity extends Activity { //-------------------------------------- private ImageView imageView; /** * Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); imageView = (ImageView) this.findViewById(R.id.imageView1); AddImageViewEvents(); } private void AddImageViewEvents() { imageView

Is it possible to get real time coordinates of an ImageView while it is in Translate animation?

Deadly 提交于 2019-11-30 22:50:59
问题 I have an image of a bullet in an ImageView that does Translate animation. I need to show real time coordinates to show how far it is from target in real time. ImageView myimage = (ImageView)findViewById(R.id.myimage); Animation animation = new TranslateAnimation(100, 200, 300, 400); animation.setDuration(1000); myimage.startAnimation(animation); animation.setRepeatCount(Animation.INFINITE); Is it possible to get real time x and y coordinates of the image while it is doing TranslateAnimation

Picasso not loading the image

不羁岁月 提交于 2019-11-30 22:34:50
问题 here's the code for picasso: ImageView img = (ImageView)findViewById(R.id.product_image); Picasso.with(this) .load(_url) .fit() .into(img, new Callback() { @Override public void onSuccess() { } @Override public void onError() { } }); here's the value of _url: http://kiagallery.ir/Images/Upload/Collection%20101/Spring%20101/d4a03b66dc7b46c694615c549b78b2e9.jpg and here's the xml: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

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

谁都会走 提交于 2019-11-30 22:18:18
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().getInputStream()); contentImageView.setImageBitmap(bmp); } catch (Exception e) { e.printStackTrace(); }

self.image.frame.width = 20 give get only property error

a 夏天 提交于 2019-11-30 21:36:02
i tried to change the width of my Image view to 20 @IBOutlet weak var image: UIImageView! using this code in viewDidLoad self.image.frame.width = 20 but it give me error cannot assign to property: width is a get only property. what does that mean?? sorry i am new to swift i do not know what it mean.please help get-only means you can only read this property (for example to compare with something), but not change. To set width you need this: self.image.frame.size.width = foo There is 2 ways to solve this: self.image.frame.size.width = some value You can add width constraint to your view (by code