imageview

How to make random images load in ImageView? (Android)

血红的双手。 提交于 2019-12-08 08:52:27
问题 I'm a begginer Android Developer And in my app I want to make a random image load out of a list of images every time then app is launched. Genneraly, I want to use ImageView because its simple, but you have to mention what image to load in the layout file or main.XML. I don't know how to do this so please help. :-) 回答1: It's not required to set the image in the .xml file Say, you have an ImageView in your layout (say its main.xml) main.xml <ImageView> android:id="@id+/myImageView" </ImageView

JavaFX PixelWriter low performance

一个人想着一个人 提交于 2019-12-08 07:26:24
问题 I created a simple JavaFX image editor. There are two instances of ImageView (on for the original image and one for the edited one). A method converts the WritableImage to grayscale. The problem is, the conversion takes approximately twice the time Swing needs to do the same task. Any idea why? @FXML void loadImage(ActionEvent event) { FileChooser fileChooser = new FileChooser(); File file = fileChooser.showOpenDialog(Main.primaryStage); if (file != null) { Image image = new Image("file:" +

Setting view alpha in runtime is slow, how to speed it up?

狂风中的少年 提交于 2019-12-08 07:21:17
问题 I have two ImageViews which I hope imageViewA is overlapped by imageViewB, and when user select a seekbar, the alpha value of imageViewB will change accordingly (e.g., becoming translucent and users can see part of imageViewA). It supposes to be a easy coding task, however I found the performance is VERY slow in my Galaxy S6. I have tried all setAlpha(int), setAlpha(float), and setImageAlpha(float), but get no hope. It seems the most related question post is App UI operations (setting alpha,

ImageView and LinearLayout, the imageview it's getting blank spaces on top and bottom of the Image

走远了吗. 提交于 2019-12-08 07:16:49
问题 I'm having some issues with LinearLayout and ImageView on Android. I must not use XML for defining the layouts, i'm trying to understand to do it with java code. I have two elements on the linearLayout, a header (imageview) and a body (gridview with images). Someting is going wrong because the imageview it's getting some blanck spaces on top and on bottom of the original Image. The original Imageview that i am using for the Header doesn't have these white spaces on top and on bottom of the

Android Bitmap OutOfMemoryError [duplicate]

。_饼干妹妹 提交于 2019-12-08 06:46:06
问题 This question already has answers here : Android: BitmapFactory.decodeStream() out of memory with a 400KB file with 2MB free heap (7 answers) Closed 6 years ago . I'm having an OutOfMemoryError in my VSD220 (It's a 22" Android based All in one) for (ImageView img : listImages) { System.gc(); Bitmap myBitmap = BitmapFactory.decodeFile(path); img.setImageBitmap(myBitmap); img.setOnClickListener(this); } I really don't know what to do, because this image is below the maximum resolution. The

Android layout - ImageView focused, but doesn't show anything on screen (no highlight)

元气小坏坏 提交于 2019-12-08 06:45:38
问题 If I set my ImageView to be both clickable and focusable, it works, but I have no way to tell which image is focused. What's the best way to get it to draw an orange border around the view so the user knows it's currently in focus? I tried dropping it in a LinearLayout and setting that to be focusable and clickable instead, but didn't have any luck. Even when I put a margin on it, there's nothing to indicate that it was selected. 回答1: You can use a drawable with a selector as the background.

xcode swift how do I split an image?

前提是你 提交于 2019-12-08 06:22:17
问题 I am working with Swift 2.0 and I would like to split an image into multiple pieces. I know this is a repeat, but they syntax is old and I am having trouble update. 回答1: update: Xcode 8.2.1 • Swift 3.0.2 You can add this extension to split your images: extension UIImage { var topHalf: UIImage? { guard let image = cgImage? .cropping(to: CGRect(origin: .zero, size: CGSize(width: size.width, height: size.height / 2 ))) else { return nil } return UIImage(cgImage: image, scale: 1, orientation:

Infinite animation of imageview android

℡╲_俬逩灬. 提交于 2019-12-08 06:07:34
问题 This is just a continuation of my unsolved question which can be found here: Animate ImageView For now, I managed to make the imageviews move using <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator"> <translate android:fromXDelta="-100%p" android:toXDelta="0%" android:duration="2000"/> </set> But what I want to accomplish is the images should accelerate from left to right and when

how to make imageview border with two color and fix size border width in andorid

爱⌒轻易说出口 提交于 2019-12-08 05:17:32
I have create the circularimageview and this image view set the two colors and this color sizw are same how to set border with fix size and two borders? **I have already use library 'com.pkmmte.view:circularimageview:1.1' ** #ce90ce inner circle # ab84ab outer circle ineer circle opacity 20% outer circle opacity 15% My Image like this My Adapter Layout <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/Background_Main"

Pick Image from Gallery/Camera/DropBox etc

孤者浪人 提交于 2019-12-08 05:00:44
问题 How to give user the option to choose image from Camera / Gallery / DropBox OR any other File systems from the device and show it in an activity as an ImageView object. 回答1: For picking image from Camera/Gallery/DropBox OR any other File systems from the device just call implicit intent... Following code may helps you... pickbtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v){ if (Environment.getExternalStorageState().equals("mounted")){ Intent intent = new