imageview

Detecting touch inside a irregular shape in ImageView

二次信任 提交于 2020-01-06 13:12:34
问题 I have an ImageView which has a transparent drawable with a circle at the center like (http://wallpaperswide.com/circle_outline-wallpapers.html). Just that the circle is red, and the surrounding are not coloured but are transparent, it is a .png image. So now I will implement Canvas.ondraw() , and when while tracing the user goes outside the circle, the drawing should restart. The doubt is: 1. How do I detect the boundaries of this image without hardcoding. 2. How do I detect that the user

Crash on using Glide library

旧巷老猫 提交于 2020-01-06 06:42:47
问题 Loading different size of images into ImageView using Glide Library. But not sure why glide fails to handle the memory consumption, recycle and reuse it. Gradle: api 'com.github.bumptech.glide:glide:4.3.0' Usage: @BindingAdapter({"imageUrl"}) public static void imageUrl(ImageView view, String imageUrl) { try { if (imageUrl!=null) { Glide.with(view.getContext()).load(imageUrl).into(view); } } catch (Exception e) { e.printStackTrace(); } } Crash Log: 04-23 13:19:34.390 4758-4758/xx.xx.xxxE

Android: Best Way to Programmatically Make an Image and Save it to a Bitmap?

断了今生、忘了曾经 提交于 2020-01-06 05:34:08
问题 I have an app that connects to an external printer device and I need to take some user data and dynamically make an image and print it. The printer API requires a bitmap as input for printing. Note that I never want to draw the programmatically created image to the screen; the generation and printing of the image have no visible UI, it happens in the background. So far I've considered doing it one of the following ways: 1) Make a canvas, never call the draw functions, translate it to a bitmap

how to get setScaleType(ImageView.ScaleType.FIT_CENTER) effect using setScaleType(ImageView.ScaleType.MATRIX)

做~自己de王妃 提交于 2020-01-06 05:01:11
问题 In Android using ImageView and Matrix, I want to scale an image to fit in the display area. Then using pinch, a user can zoom the image. Using setScaleType(ImageView.ScaleType.FIT_CENTER) I can fit my image in display area. But when I use setScaleType(ImageView.ScaleType.MATRIX) , to start zooming the image, the image gets reset to default size. So my question is how to find a scale matrix which will give same effect as setScaleType(ImageView.ScaleType.FIT_CENTER) . 回答1: You need to use

Images not displaying in imageView

笑着哭i 提交于 2020-01-06 04:58:08
问题 Currently nothing happens when I touch a button which takes me to another VC which is supposed to get an image from firebase and then display it in an image view on the VC after pressing a button called, loadImageFunc What is wrong in my code? I am getting no errors. It just does not work. import UIKit import FirebaseStorage import FirebaseDatabase import FirebaseAuth import Firebase ​ class PhaseOneViewController: UIViewController { @IBOutlet weak var p1ImageView: UIImageView! ​ @IBAction

Images not displaying in imageView

早过忘川 提交于 2020-01-06 04:58:07
问题 Currently nothing happens when I touch a button which takes me to another VC which is supposed to get an image from firebase and then display it in an image view on the VC after pressing a button called, loadImageFunc What is wrong in my code? I am getting no errors. It just does not work. import UIKit import FirebaseStorage import FirebaseDatabase import FirebaseAuth import Firebase ​ class PhaseOneViewController: UIViewController { @IBOutlet weak var p1ImageView: UIImageView! ​ @IBAction

Measuring margin of a “fitCenter” imageView in Android

依然范特西╮ 提交于 2020-01-06 02:41:08
问题 Given a simple RelativeLayout like this: <RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#0fffff"> <ImageView android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_gravity="center" android:adjustViewBounds="true" android:scaleType="fitCenter" android:src="@drawable/img001" /> </RelativeLayout> the left/top spacing between the layout border and the image border depends on the W/H ratio of the image being

Can't seem to disable anti-aliasing in Android

蓝咒 提交于 2020-01-05 07:27:10
问题 I'm new to Android, and I've finished a game which was meant to feature pixel art. I was going to scale up my images (imageviews and bitmaps drawn to canvas) from small pixelated png files. The thing is, I could not seem to disable anti-aliasing whatever method I tried. The image was always blurred. All my images are in one 'drawable' folder. I tried android:antialias="false" within the ImageView in the xml. Tried the method described here: http://www.41post.com/4241/programming/android

Constant states do not match in developer preview android L

妖精的绣舞 提交于 2020-01-05 05:26:14
问题 I am trying to do something in an if-statement, this works in every version of android (16 or higher because of the getDrawable) except Android L (tested on latest). The code is the following: if (item.getIcon().getConstantState().equals(getResources().getDrawable(R.drawable.add_to_fav_normal).getConstantState()) Any help/hints or explanation would be appreciated! 回答1: Use item.getContext().getDrawable(int) or the equivalent ContextCompat method. Starting in API 21, all framework widgets that

setOnClickListener on imageview needs to click two times in order to work

我是研究僧i 提交于 2020-01-05 03:54:06
问题 I have ImageView in my activity with the following properties i have innitialized the imageview and also set OnClickListener on ImageView , but when i click on Imageview for the first time, onlick event doesnot work but when i click on Imageview for the second time it works <ImageView android:clickable="true" android:focusable="false" android:id="@+id/switchIcon" android:layout_width="50dp" android:layout_height="45dp" android:layout_alignParentRight="true" android:layout_below="@+id/title"