imageview

android - how to get the image edge x/y position inside imageview

≯℡__Kan透↙ 提交于 2019-11-28 16:51:18
问题 If i have an ImageView that fills the screen. The ImageView background is set to green color. I place a bitmap in the ImageView, keeping bitmap proportions. A portrait photo in this layout will show green on both left and right side (Phone orientation= portrait). Now, How do i get the left side x/y position of the edge when the green ends and bitmap begins. The background for this endeavor project is that i want to write text on the image and save the image back to a new image with the text.

Remove the image from a imageview Android [duplicate]

人盡茶涼 提交于 2019-11-28 16:34:30
问题 This question already has an answer here: How to clear an ImageView in Android? 15 answers I'm trying to make an ImageView that holds a gallery of images. By touching the user request to load the next image. If the next image isn't found in the server or takes time to load I need the old image to be empty. setVisibility(View.GONE) or setVisibility(View.INVISIBLE) don't work for me because when invisible/gone I stop the onTouch() detecting (and the user is locked to current image). How can I

Android: java.lang.ClassCastException: android.widget.imageView cannot be cast to android.widget.textView

ぐ巨炮叔叔 提交于 2019-11-28 16:29:07
I can't fix this problem on my listview template: i have the error as in the title of my post, but i won't cast imageview to textview. Here's my code: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="200dip" android:layout_weight="1" android:paddingBottom="10dip" > <TextView android:id="@+id/mq" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:text="Metri quadri"

Strange behaviour of images in RecyclerView

谁都会走 提交于 2019-11-28 15:58:44
问题 I am using android.support.v7.widget.RecyclerView to show simple items containing text and in some cases also images. Basically I followed the tutorial from here https://developer.android.com/training/material/lists-cards.html and just changed the type of mDataset from String[] to JSONArray and the xml of the ViewHolder. My RecyclerView is located in a simple Fragment: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android

Images in iOS push notification

我只是一个虾纸丫 提交于 2019-11-28 14:45:34
I am trying to send images in push notifications I have made the notifications registrations in app delegate and apns device token is generating properly. ALso I have coded in service ext as follows: import UserNotifications class NotificationService: UNNotificationServiceExtension { var contentHandler: ((UNNotificationContent) -> Void)? var bestAttemptContent: UNMutableNotificationContent? override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) { self.contentHandler = contentHandler bestAttemptContent = (request

Android:Issue Image resolution

落花浮王杯 提交于 2019-11-28 14:12:24
Problem occurs while using high resolution image in device. imageview a; InputStream ims = getAssets().open("sam.png");//sam.png=520*1400 device=320*480 or 480*800 Drawable d=Drawable.createFromStream(ims, null); a.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT)); a.setImageDrawable(d); by using above code image leaves spaces on top and bottom to next contents or If I shrink an image by giving fixed px, its get blur image on its size. Anyway to solve this issue? Try to create Bitmap instead of Drawable : Bitmap bmp = BitmapFactory.decodeStream(ims); a

Create imageView programmatically in Watch Kit

霸气de小男生 提交于 2019-11-28 13:39:23
i'm trying to create an image view for a watch app, i'm trying to create programmatically but the code used in a classic view controller doesn't work. let imageName = "yourImage.png" let image = UIImage(named: imageName) let imageView = UIImageView(image: image!) imageView.frame = CGRect(x: 0, y: 0, width: 50, height: 50) view.addSubview(imageView) how i can do the same thing for watch kit? thanks You can't dynamically create views in WatchKit. You need to create your entire interface in a storyboard. You can have elements of your storyboard hidden and then programmatically unhide them. In

android - How to cut some part of image and show it in imageview

好久不见. 提交于 2019-11-28 13:29:14
I want to show only some part of image in imageview. See following image . Same example can be found in google+ app where you see all posts with images. Any links ,code will be helpful. Thanks Use this code int width = bitmapOrg.width(); int height = bitmapOrg.height(); int newWidth = 200; int newHeight = 200; // calculate the scale - in this case = 0.4f float scaleWidth = ((float) newWidth) / width; float scaleHeight = ((float) newHeight) / height; // createa matrix for the manipulation Matrix matrix = new Matrix(); // resize the bit map matrix.postScale(scaleWidth, scaleHeight); // recreate

How To Display Random images on image view

 ̄綄美尐妖づ 提交于 2019-11-28 13:05:37
Could someone please help me out with a code to randomly display a picture from the my drawings folder? i am new to java so i have no idea how to do it. Any help will be appreciated. My Requirements are:- 1.Display Random image (image should change on each start up) 2.that's all import java.util.Random; import java.util.Random; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.ImageView; public class MainMenu extends Activity { @Override protected void onCreate(Bundle

How to make application more responsive which uses several bitmaps? [closed]

旧街凉风 提交于 2019-11-28 12:43:31
问题 I'm new to Android so I'm not getting exactly how to make my application more responsive as it creates bitmaps for each processing and set to imageView.Basically What i'm trying to do is that create a bitmap, play with it,like passing values from seekBar to change its properties and set it to imageView.How to create a Copy of Bitmap object to avoid references.Any Suggestions ?? Thanks in advance 回答1: You can try this library which handles bitmap very efficiently. https://github.com/thest1