android-imageview

How to hold the selected image in GridView and pass to next activity after I click Button

Deadly 提交于 2020-08-20 06:50:09
问题 In my Activity I have an EditText , a Button and a GridView . The user selects the image from the GridView and enters the name in the EditText , and then clicks the done button. activity.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_height="match_parent" android:layout_width="match_parent" android:orientation="vertical" android:id="@+id/l1" > <View android:layout

How to get the rectangle of the Drawable of ImageView on Android?

有些话、适合烂在心里 提交于 2020-07-05 09:10:29
问题 I want to get the rectangle object that will wrap the Drawable of ImageView instead of the rectangle that will wrap the ImageView. I will use that rectangle to draw some fancy rectangle around Drawable. How can I get that rectangle? 回答1: Rect rect = new Rect(); ImageView iV = new ImageView(); rect.left = iV.getLeft(); rect.top = iV.getTop(); rect.bottom = iV.getBottom(); rect.right = iV.getRight(); Now you have your rectangle. 回答2: You can use getImageMatrix() See: Android how to get bounds

How to get the rectangle of the Drawable of ImageView on Android?

做~自己de王妃 提交于 2020-07-05 09:08:33
问题 I want to get the rectangle object that will wrap the Drawable of ImageView instead of the rectangle that will wrap the ImageView. I will use that rectangle to draw some fancy rectangle around Drawable. How can I get that rectangle? 回答1: Rect rect = new Rect(); ImageView iV = new ImageView(); rect.left = iV.getLeft(); rect.top = iV.getTop(); rect.bottom = iV.getBottom(); rect.right = iV.getRight(); Now you have your rectangle. 回答2: You can use getImageMatrix() See: Android how to get bounds

Issue with CoordinatorLayout and ImageView that adjusts width while scrolling

我是研究僧i 提交于 2020-07-04 06:28:49
问题 I'm attempting to put an ImageView in a CollapsingToolbarLayout in which it takes up the full screen on load and as you scroll the content, the 16x9 resolution image width resizes until the image takes up the full width of the screen. At that point, I'd like the image to parallax with a app:layout_collapseParallaxMultiplier of 0.5 Using this XML Layout: <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res

Android Kotlin: fetching image from directory

扶醉桌前 提交于 2020-06-06 08:34:05
问题 I am building an app with Kotlin frontend/Python backend. My python script creates a .png file under getFilesDir() directory (/data/user/0/com.example.myproject/files/mygraph.png). I then want to use kotlin to fetch the .png file and display it on imageview. Believe I have to use Bitmap but am not familiar with it so your support is much appreciated. class Graph : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R

RuntimeException : Width (0) and height (0) cannot be <= 0

我们两清 提交于 2020-05-31 03:02:17
问题 I have got this type of error, How may I resolve this issue. java.lang.RuntimeException: java.lang.RuntimeException: Error while processing D:\Android Project\AttendanceApp\app\src\main\res\drawable\ic_arrow_back.xml : Width (0) and height (0) cannot be <= 0 ic_arrow_back.xml <vector android:height="@dimen/_25sdp" android:tint="#FFFFFF" android:viewportHeight="24.0" android:viewportWidth="24.0" android:width="@dimen/_25sdp" xmlns:android="http://schemas.android.com/apk/res/android"> <path

Displaying multiple camera images to Grid view

假装没事ソ 提交于 2020-05-16 02:24:13
问题 i want to display multiple images capture by camera to Grid view. i go through many questions how to do but non perfectly work for me. i use This to implement. but using this i am able to get the image in my image view but whenever i capture new image that image replace my older image. and now i am clue less what should i do to add camera images one after another. anyone know how to implement this then please help me with sample code. thank you in advance. 回答1: Use the comment provided in the

Displaying multiple camera images to Grid view

大城市里の小女人 提交于 2020-05-16 02:20:09
问题 i want to display multiple images capture by camera to Grid view. i go through many questions how to do but non perfectly work for me. i use This to implement. but using this i am able to get the image in my image view but whenever i capture new image that image replace my older image. and now i am clue less what should i do to add camera images one after another. anyone know how to implement this then please help me with sample code. thank you in advance. 回答1: Use the comment provided in the

Removing transparent area in ImageView

廉价感情. 提交于 2020-03-02 07:00:28
问题 I have one mask image, this image is transparent and I will change the image size dynamically. The problem is that the image is displayed in a square/rectangle form. The ImageView is also displaying the transparent area image, so how to remove the transparent area? The image is: 回答1: If you want to increase size as Imageview size change then you have to set Image as its background . Try using setBackgroundResource() you can able to increase your ImageView image 回答2: for changing the size of

add Layout programmatically inside another one

纵饮孤独 提交于 2020-02-19 10:08:49
问题 I have an xml file (option_element.xml) that contains a ImageView and a TextView <?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="match_parent" android:layout_marginTop="-18dp" > <ImageView android:id="@+id/button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:src="@drawable/option_button" />