dimensions

Android - Programmatically specify height and width of new ScrollView

妖精的绣舞 提交于 2019-12-04 13:47:40
问题 I'm new to Android and I'm working through a tutorial on programmatically creating a layout instead of doing it through the xml, I'm sorta stuck can someone advise please. So I have a ScrollView then have added a LinearLayout into it, I want both to be a specific size - 480 x 800 (code below). I was able to set the size in the LinearLayout but I cannot get the ScrollView to also be that size but I can't find how to do it. Is this possible, and can I therefore just specify the ScrollView

How to add a dimension to a numpy array in Python

两盒软妹~` 提交于 2019-12-04 05:55:01
问题 I have an array that is size (214, 144). I need it to be (214,144,1) is there a way to do this easily in Python? Basically the dimensions are supposed to be (Days, Times, Stations). Since I only have 1 station's data that dimension would be a 1. However if I could also make the code flexible enough work for say 2 stations that would be great (e.g. changing the dimension size from (428,288) to (214,144,2)) that would be great! 回答1: You could use reshape: >>> a = numpy.array([[1,2,3,4,5,6],[7,8

Different values folders in android

∥☆過路亽.° 提交于 2019-12-04 05:42:53
问题 I am creating different values folders in my app (values, values-ldpi, values-mdpi, values-hdpi, values-xhdpi, values-nodpi, values-w360dp-mdpi) . But some devices that belong same category. But having different screen sizes. But I see give font size according to device densities in this the answer provided by @PankajSharma suggest to create folders like- res/values/dimens.xml res/values-small/dimens.xml res/values-normal/dimens.xml res/values-xlarge/dimens.xml I want to know what is the

Price calculation based on dimensions in WooCommerce single product page

半世苍凉 提交于 2019-12-04 03:24:35
问题 Based on "Get selected variation price in jQuery on Woocommerce Variable products" answer code, in my code bellow, I have a problem with the price calculation of a WooCommerce variable product. The price gets multiplied with 10 or 1000, depending on the option selected on a dropdown, which is not supposed to happen and I don't know why it is happening. Here is my code: <script> jQuery(function($) { var jsonData = <?php echo json_encode($variations_data); ?>, inputVID = 'input.variation_id'; $

How to get the stage dimensions with StageScaleMode.SHOW_ALL?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-03 16:44:51
If you set the stage.scaleMode to StageScaleMode.SHOW_ALL, your swf may be scaled up or down, and may be padded on the top/bottom or left/right. However, stage.width + height always return the width and height as defined by your swf, and stage.scaleX + Y always return 1. As I understand it, resize events are not thrown. So how do I get the actual scale and dimensions? I want them for two problems: I want to fill that padding on the top/bottom or left/right with something only if the user can see it. I am drawing vectors into bitmaps and want to properly scale it so it doesn't look jagged (or

Accessing image dimensions on an ImageField in a Django template?

青春壹個敷衍的年華 提交于 2019-12-03 16:20:55
问题 I have ImageField in my model and I'm able to display the image in a template. However, how do I retrieve the image's height and width? 回答1: See the documentation for ImageField. In addition to the special attributes that are available for FileField, an ImageField also has height and width attributes. So just do the following: <img src="{{ image.url }}" width="{{ image.width }}" height="{{ image.height }}"/> 回答2: In my case, for the width and height fields to work, I need to set the width

C++/Size of a 2d vector

非 Y 不嫁゛ 提交于 2019-12-03 15:13:43
问题 How do I find the size of a 2 dimensional vector? So far I have the following code which doesn't compile. #include <iostream> #include <vector> using namespace std; int main() { vector < vector <int> > v2d; for (int x = 0; x < 3; x++) { for (int y = 0; y < 5; y++) { v2d.push_back(vector <int> ()); v2d[x].push_back(y); } } cout<<v2d[0].size()<<endl; cout<<v2d[0][0].size()<<endl; return 0; } 回答1: To get the size of v2d , simply use v2d.size() . For size of each vector inside v2d , use v2d[k]

Can I hide an image button on a layout, (dimensions and background) until a call to set visible?

你离开我真会死。 提交于 2019-12-03 13:53:10
问题 I have a hidden image button in one of my xmls layouts, with a background set to a drawable image. I set the visibility to invisible, as I only want the image to display every once in a while. The problem is, even if the drawable isn't shown, the image button still takes us space - Is there a way to hide the background image, and make it's dimensions 0 until I call on it to be shown in my main class? Thanks! Edit: So in my xml, how would I write that? <ImageButton android:id="@+id/myimage"

Find the dimensions of a multidimensional Python array

旧街凉风 提交于 2019-12-03 12:06:54
In Python, is it possible to write a function that returns the dimensions of a multidimensional array (given the assumption that the array's dimensions are not jagged)? For example, the dimensions of [[2,3], [4,2], [3,2]] would be [3, 2] , while the dimensions of [[[3,2], [4,5]],[[3,4],[2,3]]] would be [2,2,2] . Does Python have any built-in functions that will return all of the dimensions of a multidimensional array, or will I need to implement this function myself? No, there's nothing built-in because with such "arrays" 1 it can be jagged and the concept of "dimensions" or "shape" doesn't

How do you get the width and height of an SVG picture in PHP?

試著忘記壹切 提交于 2019-12-03 10:37:43
I tried to use getimagesize() on an SVG file, but it failed. I know that SVG is “Scalable Vector Graphics”, but I find that Google Chrome’s “Review elements” can perfectly get the dimensions of an SVG picture, so I suspect that this is also possible in PHP. If it is difficult to get the dimensions, is there any way to judge whether an SVG picture is vertical or horizontal? Williham Totland The thing is: SVG images don't have a "size" in the sense you are probably thinking of. On the other hand, they DO have a height-to-width ratio. This ratio can usually be found in the viewBox attribute. If,