imageview

how can I show a video thumbnail from a video path?

左心房为你撑大大i 提交于 2020-04-11 04:55:32
问题 I want to show a video thumbnail in an ImageView from a video path on storage. Is there a function that takes a video path and returns a bitmap of a thumbnail? I get the video path by this code: public ArrayList<String> getAllMedia() { HashSet<String> videoItemHashSet = new HashSet<>(); String[] projection = {MediaStore.Video.VideoColumns.DATA, MediaStore.Video.Media.DISPLAY_NAME}; Cursor cursor = getContext().getContentResolver().query(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, projection,

Cropping square image into circular image in android

旧街凉风 提交于 2020-02-27 12:35:50
问题 I want a square image to be converted to circular image and displayed in the imageview. Image 1 is the required output, image two is the sqaure source image and image3 is the current output from the code pasted below. Code for cropping square image and than converting into circular image is pasted below. Please have a look at it and correct it. private Bitmap cutCenterSquare(Bitmap bitmap) { Bitmap origialBitmap = bitmap; Bitmap cutBitmap = Bitmap.createBitmap(origialBitmap.getWidth() / 2,

Cropping square image into circular image in android

孤者浪人 提交于 2020-02-27 12:32:19
问题 I want a square image to be converted to circular image and displayed in the imageview. Image 1 is the required output, image two is the sqaure source image and image3 is the current output from the code pasted below. Code for cropping square image and than converting into circular image is pasted below. Please have a look at it and correct it. private Bitmap cutCenterSquare(Bitmap bitmap) { Bitmap origialBitmap = bitmap; Bitmap cutBitmap = Bitmap.createBitmap(origialBitmap.getWidth() / 2,

RotateAnimation get current angle

馋奶兔 提交于 2020-02-25 04:32:09
问题 Any tricks to get RotateAnimation current angle? I've an imageview that is rotate with RotateAnimation, imageview.getRotation() is always 0.0. Maybe it's a trick to get the rotation angle ? Thaks 回答1: You can use SensorEvent or Position Sensor for get rotation angle. This is help for SensorEvent here. This is help for PositionSensors here. I hope this is help you. 来源: https://stackoverflow.com/questions/26139963/rotateanimation-get-current-angle

set height of imageview as matchparent programmatically

丶灬走出姿态 提交于 2020-02-17 00:01:28
问题 I need to set the height of an imageview as matchparent programatically.if it is a fixed height i know how to set. but how can i set it as matchparent? EDIT: actually height of the parent layout is dynamic.so i need to make the height of the imageview as the height of parent. 回答1: initiate LayoutParams . assign the parent's width and height and pass it to setLayoutParams method of the imageview 回答2: imageView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH

Set ImageView Size Programmatically in DP Java

时光怂恿深爱的人放手 提交于 2020-02-06 05:07:12
问题 I want to set the width and height of an ImageView in Android . The ImageView does not exist in XML . It is created here: public void setImageView(int i,Integer d, LinearLayout layout ) { ImageView imageView = new ImageView(this); imageView.setId(i); imageView.setPadding(2, 2, 2, 2); imageView.setImageBitmap(BitmapFactory.decodeResource(getResources(), d)); imageView.setScaleType(ImageView.ScaleType.FIT_XY); layout.addView(imageView); } And it is placed into this LinearLayout :

ListView - Images shuffle while scrolling

久未见 提交于 2020-02-02 03:02:18
问题 I have a ListView with two TextViews and one ImageView. The images are loaded from the Internet and are cached by LruCache. While scrolling through the ListView the images are getting shuffled for a few seconds. Ther just shouldn't be any image until the right image is fully loaded. I found a few questions with the same problem but no one helped me :/. Here's my code: public class NewsAdapter extends BaseAdapter { private static LayoutInflater inflater; private List<Item> items = new

Why are the Width / Height of the drawable in ImageView wrong?

人走茶凉 提交于 2020-01-29 11:34:33
问题 Should be a simple one. When I pull image.getDrawable().getIntrinsicWidth() I get a value larger than the source image width. It's X coordinate is returning 2880 instead of 1920 which is 1.5 times too big? I wondered wether the ImageView having a scaleType of "center" effected it but, according to the documentation: "Center the image in the view, but perform no scaling. " Here is the source: <ImageView android:id="@+id/backgroundImage" android:layout_width="wrap_content" android:layout_height

Why are the Width / Height of the drawable in ImageView wrong?

ε祈祈猫儿з 提交于 2020-01-29 11:34:05
问题 Should be a simple one. When I pull image.getDrawable().getIntrinsicWidth() I get a value larger than the source image width. It's X coordinate is returning 2880 instead of 1920 which is 1.5 times too big? I wondered wether the ImageView having a scaleType of "center" effected it but, according to the documentation: "Center the image in the view, but perform no scaling. " Here is the source: <ImageView android:id="@+id/backgroundImage" android:layout_width="wrap_content" android:layout_height

doesn't show picture in android 6 and above

强颜欢笑 提交于 2020-01-27 08:47:25
问题 I am trying to learn how to use the camera in an app and this is what I reached , the idea is having a button that opens the camera and that the picture will instantly show on the screen after we take the picture, the second button is from an earlier version that couldn't show the picture immediately and had to be clicked in order to show it. Anyways my problem is that this code doesn't show the picture at android 6.. on my android 5 device it works fine.. the picture is saved in the "sdcard