imageview

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

旧时模样 提交于 2019-11-30 04:55:35
问题 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 回答1: 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 回答2: There is

How to get image from url website in imageview in android

独自空忆成欢 提交于 2019-11-30 04:24:40
问题 I am trying to get image in ImageView from url website but the image not show so, What is the wrong in this code? This is the url of the image. It is my Main Activity ImageView i; private Bitmap bitmap; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); i=(ImageView)findViewById(R.id.ImageView1); bitmap=GetBitmapfromUrl("http://test-dashboard1.seeloz.com/system/images/products_images/86/5454544114

Android: Slow performance using a big image in ImageView

点点圈 提交于 2019-11-30 04:13:49
问题 I have an Activity where I have a background image in an ImageView, and nine transparent buttons on top of the image. http://i.stack.imgur.com/GGQqd.png When I tap any of the buttons I make a RelativeLayout appears in the top of the background. http://i.stack.imgur.com/JvKQK.jpg The problem is: When I use a big resolution image as a background in the layout the performance is very poor. I'm using a PNG image of 2048 x 1536 , and it's weight is about 500k. When I use a smaller image like 1024

How to display .gif file in imageview?

≡放荡痞女 提交于 2019-11-30 02:41:53
My layout have lots of imageviews. I want to show .gif animated file in just one imageview. I tried Yash method ( Adding gif image in an ImageView in android ) but .gif file shown all layout. Other views dissappeared. I want to show all. Any idea? Put your .gif file into res/raw folder, in your fragment or activity and than you can set gif in imageview like GifAnimationDrawable gif; try { gif = new GifAnimationDrawable(getResources().openRawResource(R.raw.download)); gif.setOneShot(false); } catch (NotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); }

Android ImageView图片显示点击背景切换

我的未来我决定 提交于 2019-11-30 02:10:55
一.介绍 ImageView用来显示任意图像图片,可以自己定义显示尺寸,显示颜色等等. 二.XML属性 android:adjustViewBounds 是否保持宽高比。需要与maxWidth、MaxHeight一起使用,单独使用没有效果。 android:cropToPadding 是否截取指定区域用空白代替。单独设置无效果,需要与scrollY一起使用 android:maxHeight 定义View的最大高度,需要与AdjustViewBounds一起使用,单独使用没有效果。如果想设置图片固定大小,又想保持图片宽高比,需要如下设置: 1) 设置AdjustViewBounds为true; 2) 设置maxWidth、MaxHeight; 3) 设置设置layout_width和layout_height为wrap_content。 android:maxWidth 设置View的最大宽度。 android:scaleType 设置图片的填充方式。 android:src 设置View的图片或颜色 android:tint 将图片渲染成指定的颜色。 使用Martix(android.graphics.Matrix)类中的postScale()方法结合Bitmap来实现缩放图片的功能 Bitmap bmp = BitmapFactory.decodeResource

How to set VectorDrawable as an image for ImageView programmatically

吃可爱长大的小学妹 提交于 2019-11-30 01:14:33
I want to set some vectorDrawables to a ImageView in Android Studio. I can set png and jpg drawable easily but when i want to set VectorDrawable, it does not work on imageview. img.setImageResource(R.drawable.ic_home); ic_home is VectorDrawable and this code doesn't work. Pramod Baggolli If you want to use vector drawables (less OR greater than API 21) just do the following: Set the image programmatically (e.g. in your activity): imageView.setImageResource(R.drawable.ic_left_arrow_blue); or by XML: app:srcCompat="@drawable/your_vector_name" In your app's build.gradle you need to include:

Using picasso library with a circle image view

谁说我不能喝 提交于 2019-11-30 00:39:59
问题 I am looking at using the Picasso library to download an image from URL and pass this into circle image view, but since picasso requires that you pass in an actual imageView I have come to a standstill on how to do it I am using the picasso library from here http://square.github.io/picasso/ and the circle image view class from here https://github.com/hdodenhof/CircleImageView Here is the start of my code to get the image private void getData() { userName.setText(prefs.getString("userName","")

Draw Rectangle Over ImageView for highlight that can be zoom in-out in android

戏子无情 提交于 2019-11-30 00:25:49
I have been refer this example from SO below are they. 1. Draw Line Over ImageView 2. Draw Picture Over ImageView 3.I have use this ImageView Class for my image to become zoom in-out Image Pinch zoom code google . Now what i am try to do is : I want to make zoom in by pinching the screen and other point is that when i do single tap a rectangle should be drawn over image view and i also want this rectangle should get zoom in & out with imageView's Zoom in and Zoom Out and i want to use it through ScaleImageView class. Output of this should look like below image. And i also known that ,this can

Imageview issue with zoom in and out,drag with maximum and minimum levels

家住魔仙堡 提交于 2019-11-29 23:54:34
问题 I had implemented an image view with the zoom and drag functionalities.I am using matrix for the zoom and drag functionality.But my problem is that I cant set my minimum and maximum zoom level and the drag space limit.can any on e tell me how I can do that. private float spacing(MotionEvent event) { float x = event.getX(0) - event.getX(1); float y = event.getY(0) - event.getY(1); return FloatMath.sqrt(x * x + y * y); } private void midPoint(PointF point, MotionEvent event) { float x = event

Imageview set color filter to gradient

依然范特西╮ 提交于 2019-11-29 23:31:39
I have a white image that I'd like to color with a gradient. Instead of generating a bunch of images each colored with a specific gradient, I'd like to do this in code (not xml). To change an image's color, I use imageView.setColorFilter(Color.GREEN); And this works fine. But how can I apply a gradient color instead of a solid color? LinearGradient doesn't help, because setColorFilter can't be applied to Shader objects. EDIT : This is the image I have: This is what I want: And this is what I'm getting: You have to get Bitmap of your ImageView and redraw same Bitmap with Shader public void