bounds

Android how to get bounds of imageview with matrix

妖精的绣舞 提交于 2019-12-05 21:21:57
I have an ImageView with scaletype set to matrix, and would like to get a Rect with the bounds of the image after the transformation of the matrix. How do I get such a rect? thanks. ImageView imageView = (ImageView)findViewById(R.id.imageview); Drawable drawable = imageView.getDrawable(); Rect imageBounds = drawable.getBounds(); Then use Matrix.mapRect. 来源: https://stackoverflow.com/questions/8590693/android-how-to-get-bounds-of-imageview-with-matrix

What is the correlation between bounds.size and frame.size when animating UICollectionViewCell

妖精的绣舞 提交于 2019-12-05 14:36:09
I've read on several posts (like https://stackoverflow.com/a/5340339/1084822 and https://stackoverflow.com/a/15582466/1084822 ) that to resize a UIView with animation, we can't animate the frame and we must do it with a mix of bounds.size, bounds.origin and position. However, I can't find what is the correlation between those properties and those of the frame. I have a UICollectionView with a custom layout. When a cell is deleted, the layout is refreshed and every cell gets its new frame through the prepareLayout and layoutAttributesForElementsInRect: methods. Then, the

Set Map Bounds with different padding

我的梦境 提交于 2019-12-05 01:40:12
I want to know if ther is any way of set different padding from each site of the Device for Google maps bounds. Because I have an mpview witch match the whole activity, but I have a MapOverlay (some Text inside a linerar Layout with non transulent background) on the bottom 1/3 off the screen. And now i want to zoom in by using map bounds. But it should have more padding from the bottom so it didn't get behind my mapOverlay. I use this code with the padding of 120. final com.google.android.gms.maps.model.LatLngBounds.Builder bounds = new LatLngBounds.Builder(); bounds.include(pref

Should I use std::vector::at() in my code

Deadly 提交于 2019-12-04 22:55:36
I noticed today that std::vector::at() is significantly slower than accessing values with square brackets [] . According to the doc .at() is safer because it won't let me access values beyond the bounds of the array. However, even if I access out of bound values with at() , I'll obviously still have an error, so that's something I need to avoid no matter what. So is there any good reason why anyone would use at() instead of [] ? If you have reason to believe that the index is not in your control, or if the control flow is particularly complicated and you're tracing bugs, then you might want to

time array out of bounds in modelling?

╄→尐↘猪︶ㄣ 提交于 2019-12-04 21:13:48
These days I'm trying to run my climate model with new meteorology data (which is given in netcdf format instead of the old cray format). The model is compiled smoothly, however when it's time for the simulation the model runs well the first day but it stops in the second day of simulation, always at same time step, no matter what start date I use. The error is: forrtl: severe (408): fort: (2): Subscript #1 of the array TIMEVALS has value 141 which is greater than the upper bound of 140. So I did some research and went through my source code to see what kind of array timevals refers to and I

Bounds.Intersect for WPF

送分小仙女□ 提交于 2019-12-04 18:40:52
I have a Winforms app that allows the user to drag and drop some labels around the screen. The objective being to put the matching labels on top of each other. I keep a reference to these labels in a list, and at the moment i'm checking to see if they're overlapping by doing the following. foreach (List<Label> labels in LabelsList) { var border = labels[1].Bounds; border.Offset(pnl_content.Location); if (border.IntersectsWith(labels[0].Bounds)) { labels[1].ForeColor = Color.Green; } else { labels[1].ForeColor = Color.Red; } } The problem being that this is only good for Winforms (Bounds

Image out of bounds after transformation on view

南笙酒味 提交于 2019-12-04 09:03:22
I'm having a problem with displaying my image. I have an Image I want to display full screen. So I have this Imageview with match_parent and 20dp padding. It looks good but when I apply rotation on it, it seems that the bounds of the view doesn't change and the image can get clipped out of the screen ! Totally don't want that to happen! How do I rescale the image so that the image also fits in the ImageView when its 90 degrees rotated. This is my XML WITH rotation in it. EDIT: How to fix the bounds of the Image so the Text is aligned just above the image? The rotation is not taken into account

Java Arry Index Out of Bound Exception

China☆狼群 提交于 2019-12-04 06:33:12
问题 I have been working on this basic java program when I need to store 5 user entered values into an array, send it to a method, and find and display the lowest value. The program is simple enough, and it runs, but when I enter the last number, I get the error: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 4 at minNumber.main(minNumber:14) Help? import java.util.*; class minNumber { public static void main(String args[]){ Scanner input = new Scanner(System.in); int

Getting string size in java (without having a Graphics object available)

限于喜欢 提交于 2019-12-04 00:00:58
问题 I'm trying to write application which need to draw many strings using Graphics2D class in Java. I need to get sizes of each String object (to calculate exact position of each string). There is so many strings that it should be done before the paint() method is called and only once at the beginning of my program (so then I don't have Graphics2D object yet). I know that there is a method Font.getStringBounds() but it needs a FontRenderContext object as a parameter. When i tried to create my own

Google Maps Static API - Get SW and NE by center coordinate

不打扰是莪最后的温柔 提交于 2019-12-03 17:26:29
问题 I'm loading map tiles from Google Maps using Static Maps, using .NET. The problem I'm having is that I don't know what the SW and NE coordinates are of the returned image. I've found many different code samples, formulas, but they all seem to be flawed. This is the one that got closest to the correct answer. When I entered the coordinates in Google Maps it showed that it was a little bit off. var result = GoogleMapsAPI.GetBounds(new Coordinate(4.79635, 51.15479), 20, 512, 512); public static