imageview

Getting the background color of an ImageView

末鹿安然 提交于 2020-01-20 05:00:28
问题 I have a plain ImageView object colorSquare . It is straightforward to set the color of the object by calling. colorSquare.setBackgroundColor(color); But how do I do the reverse, i.e. retrieve the color of the ImageView background? 回答1: What u can do is get ColorDrawable from ImageView. ColorDrawable drawable = (ColorDrawable) colorSquare.getBackground(); now drawable.getColor() will give u the Color. This will work only if u have set the Color or else u will get ClassCastException 回答2:

How to make my ImageView zoomable?

痴心易碎 提交于 2020-01-19 23:32:35
问题 Can anyone help on how to use the matrix scaletype to zoom an imageview and also how to use the translate method so that it can be focused at the center? I have tried using webview to be able to use the zooming and scrolling functionalities i needed but it is not nice to look at. 回答1: I found a tutorial divided into 4 parts from a blog on how to zoom and pan an image and it is quite nice. It has sample codes that can be downloaded and some explanations. It also have other tutorials. Update -

Creating bitmap from area selected by touch, returns wrong image part android

淺唱寂寞╮ 提交于 2020-01-17 15:18:46
问题 I use custom view placed over an image view like that <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:weightSum="5" tools:context=".TextRecognitionActivity"> <ImageView android:id="@+id/surfaceViewImage" android:layout_width="match_parent" android:layout_height="match_parent

Creating bitmap from area selected by touch, returns wrong image part android

∥☆過路亽.° 提交于 2020-01-17 15:17:05
问题 I use custom view placed over an image view like that <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:weightSum="5" tools:context=".TextRecognitionActivity"> <ImageView android:id="@+id/surfaceViewImage" android:layout_width="match_parent" android:layout_height="match_parent

How to scale small imageview to fill large scrollview?

走远了吗. 提交于 2020-01-17 04:04:05
问题 How do you create a layout with a screen-filling scrollview that has a small image in an imageview scaled to fit the whole scrollview and be scrollable? eg. A 720x1280 display has a full-screen scrollview (fill_parent). Inside is a linearlayout (fill_parent). In that is a 300x900 bitmap in an imageview that is upscaled to 720x2160, fills the screen width and exceeds the vertical bounds, and can be scrolled up/down in the scrollview. The solution should work for all screen sizes to support

How to scale small imageview to fill large scrollview?

て烟熏妆下的殇ゞ 提交于 2020-01-17 04:04:00
问题 How do you create a layout with a screen-filling scrollview that has a small image in an imageview scaled to fit the whole scrollview and be scrollable? eg. A 720x1280 display has a full-screen scrollview (fill_parent). Inside is a linearlayout (fill_parent). In that is a 300x900 bitmap in an imageview that is upscaled to 720x2160, fills the screen width and exceeds the vertical bounds, and can be scrolled up/down in the scrollview. The solution should work for all screen sizes to support

ImageView subclass to make Rounded Right Corner

放肆的年华 提交于 2020-01-16 16:47:28
问题 I am trying to take an image like these and turn them into the top right 1/4 of the image. The image below is an example of what I need. **UPDATE: ** I have it (sort of) working, but scaling the image creates an unacceptable amount of distortion my code seems terribly inefficient. Any ideas on how to improve this code or a possible better approach? I am subclassing Volley's NetworkImageView. Here is my code <com.RoundedNetworkImageView android:id="@+id/smallProductImage" android:layout_width=

ImageView subclass to make Rounded Right Corner

ぐ巨炮叔叔 提交于 2020-01-16 16:47:26
问题 I am trying to take an image like these and turn them into the top right 1/4 of the image. The image below is an example of what I need. **UPDATE: ** I have it (sort of) working, but scaling the image creates an unacceptable amount of distortion my code seems terribly inefficient. Any ideas on how to improve this code or a possible better approach? I am subclassing Volley's NetworkImageView. Here is my code <com.RoundedNetworkImageView android:id="@+id/smallProductImage" android:layout_width=

Android ImageView blurry?

﹥>﹥吖頭↗ 提交于 2020-01-16 11:44:31
问题 I have an imageview in my app and I am loading in an image that is the same size as the imageview I have setup 144x144. When I run the app the image is very blurry. I have set scaleType to fitCenter, but no change. Is there something I am doing wrong? If I look at any image on a website thru the device the image is clean and crisp so I know it isn't the phone screen. 回答1: The issue was the images were stored in the medium resolution folder. Copying it to the high resolution folder fixed the

Android - Touch to erase portions of foreground ImageView to expose background View

你离开我真会死。 提交于 2020-01-16 11:27:26
问题 So I've been struggling with this for a better part of a day. Suppose I have a custom ImageView that I want to overlay over a background View (both within a RelativeLayout), which when touched, it erases portions of the View's source bitmap like an erase tool in MS Paint, exposing the View below it. I've checked pretty much all of the threads (like this one) and they suggest to use PorterDuff SRC Mode in the Paint object as well as creating a Canvas out out the ARGB_8888 shadow copy of the