imageview

Why does getActivity() block during JUnit test when custom ImageView calls startAnimation(Animation)?

左心房为你撑大大i 提交于 2019-11-28 04:14:57
问题 I wrote an Android app that displays a custom ImageView that rotates itself periodically, using startAnimation(Animation) . The app works fine, but if I create a JUnit test of type ActivityInstrumentationTestCase2 and the test calls getActivity() , that call to getActivity() never returns until the app goes to the background (for example, the device's home button is pressed). After much time and frustration, I found that getActivity() returns immediately if I comment out the call to

How to get the size of bitmap after displaying it in ImageView

耗尽温柔 提交于 2019-11-28 03:59:13
问题 I have a imageview <ImageView android:id="@+id/imgCaptured" android:layout_width="fill_parent" android:layout_height="fill_parent" android:adjustViewBounds="true" android:scaleType="fitXY" android:src="@drawable/captured_image" /> I capture a image from camera, converted that image into bitmap. Bitmap thumbnail; thumbnail = MediaStore.Images.Media.getBitmap(getActivity() .getContentResolver(), imageUri); when i get the resolution of this bitmap before displaying it in my above imageview, like

Android ImageView - Get coordinates of tap (click) regardless of scroll location or zoom scale

不羁岁月 提交于 2019-11-28 03:52:17
Background: I have an ImageView that I've modified to be scrollable (drag) and zoom-able (pinch zoom). I used the exact technique mentioned in the "Hello, Android" 3rd edition book that can also be found here . This technique uses matrix transformation to handle both scrolling and zooming. My Problem: When a user taps on the image, I want the coordinates of that tap in relation to the image itself, regardless of how the image has been scrolled or magnified. For instance, if my image is 1000x2000 and I scroll and zoom the image. Then I tap on the image at a certain point, I want to know what

How to crop Bitmap Center like imageview? [duplicate]

只谈情不闲聊 提交于 2019-11-28 03:50:57
Possible Duplicate: How to crop the parsed image in android? How does one crop the same way as Androids ImageView is doing android:scaleType="centerCrop" Albin Your question is a bit short of information on what you want to accomplish, but I guess you have a Bitmap and want to scale that to a new size and that the scaling should be done as "centerCrop" works for ImageViews. From Docs Scale the image uniformly (maintain the image's aspect ratio) so that both dimensions (width and height) of the image will be equal to or larger than the corresponding dimension of the view (minus padding). As far

How to get Coordinates on touch Event on bitmap not of Screen

坚强是说给别人听的谎言 提交于 2019-11-28 01:59:23
问题 Greets , How can I get the Coordinates of the Bitmap not of the screen. Screen Coordinates got by event.getX(),event.getY() methods but not getting coordinates of the bitmap. Please help anyone. 回答1: You can't get the coordinates of the bitmap directly. You need to calculate to yourself. Use the position of the ImageView, and with that you can handle it. Of course, when you are after Activity onCreate you can acces to any inflated (active) views parameter. Exemple. ImageView a; a

Android: How to get Drawable Image name

余生长醉 提交于 2019-11-28 01:59:16
I want to get the name of the drawable image and want to store that name in a string. For example , for an Image, I might use a .png file named play.png or stop.png. I just want to know which image in drawable is used for the ImageView.. Is there any way to get the name of the drawable/(??.png) Thanks. I donot think there is any direct way to get name of drawable image unless you stores the image name along with image. In XML you can do the following to set image name as an additional data to imageview android:tag="btful.png" Programmetically setting imagename ImageView img = (ImageView)

Android - combine multiple images into one ImageView

依然范特西╮ 提交于 2019-11-28 01:34:18
问题 I'm looking for help developing (or a library) which can allow me to merge together multiple images into one imageview. My application is grouping together interactions between users, instead of displaying them singularly, and therefore I would like to merge all of their avatars, so that one adapter cell visualizes a "group". A fantastic example of this is done on facebook.com's chat as such: My question is, how can I provide this functionality in Android / Java? Presumably, it could a number

Centering an image in an ImageView

一个人想着一个人 提交于 2019-11-28 01:06:46
问题 I am currently trying to center an image in an ImageView using JavaFX. So I load the image in the view : Image img = new Image("..."); imageView.setImage(img); and let's suppose the image is huge (2000x3000) and not the ImageView (400x100) The rendered image will be aligned on the left, and I would like to put in the center of the ImageView : Is there anyway to perform that ? 回答1: So, after days of calculation, I managed to find a good way to do it. I post it here in case of someone would

How can i develop the PagerSlidingTabStrip with images in android?

馋奶兔 提交于 2019-11-28 00:28:08
I am using the PagerSlidingTabStrip in myapp .In this titles are setting fine but images are not setting tabstrip .I searched alot in google but didn't get the correct result.But this is very important for me. Please see screenshot below Advance thanks to all. I was also interested doing same as yours, Finally I did it for you. Import 'SlidingTabsBasic' demo from android-sdk sample or download it from google android samples from Here . 1.create custom_tab.xml with only a TextView 2.In 'SlidingTabsBasicFragment.class' do below changes: -add this code in onViewCreated() mSlidingTabLayout =

Resize images with Glide in a ImageView Android

[亡魂溺海] 提交于 2019-11-27 23:49:11
问题 I have a lot of doubts about the treatment of the images in android, and I was hoping to see if you could solve them. At this point I have an image that occupies 320 dp high, and match_parent width, which is around 60% of the screen. This image of the load with Glide, of some images in 1080 that I have personally. I tried to make centroCrop and fitXY, but always deform the images. The first type I know cuts the image, but the second one fits a size, but it does deform the image high or wide.