JQuery mobile中WebView底部的空白区域(White space at bottom of WebView in JQuery mobile)
我使用的是jquery-mobile的1.0a3版本。 问题是约有一个白色空间。 40像素被添加到WebView的底部。 在Android模拟器中,空白不会总是出现,当它出现时,我得到a
Can't get the viewWidth after the first layout
警告Can't get the viewWidth after the first layout
。 在2.3.3上。 设备的白色空间总是显示出来。我尝试切换到版本1.0a2,1.0a4和1.0b2,但在1.0a2上,屏幕在取向变化时变为空白,而在1.0b2和1.0a4上,以不希望的方式分割按钮外观变化。 在CSS中我没有改变自己。
为了摆脱白色空间,可能会发生什么变化?
I am using 1.0a3 version of jquery-mobile. The problem is that a white space of approx. 40 px is added to the bottom of a WebView. In the Android emulator the white space doesn't appear always, when it does, i get a
Can't get the viewWidth after the first layout
warning. On a 2.3.3. device the white space does always show up.I tried switching to version 1.0a2, 1.0a4 and 1.0b2, but on 1.0a2 the screen goes blank on orientation change, and on 1.0b2 and 1.0a4 split button appearance changes in a not desired way. I haven't changed nothing myself in the css.
What could be the things to change to get rid of the white space?
原文:https://stackoverflow.com/questions/6888507
最满意答案
您还可以使用NumPy库(它不是标准库的一部分,但是相对容易获得),它具有以下功能:
>>> import numpy as np >>> np.arange(0.0, 1.0, 0.1) array([ 0. , 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9])
以及
linspace
功能,可以控制端点发生的情况(当事情不会总是划分成正确数量的“slice”时,浮点数不是微不足道的):>>> np.linspace(0,1,11) array([ 0. , 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1. ]) >>> np.linspace(0,1,10,endpoint=False) array([ 0. , 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9])
Rather than using a decimal step directly, it's much safer to express this in terms of how many points you want. Otherwise, floating-point rounding error is likely to give you a wrong result.
You can use the
linspace
function from the NumPy library (which isn't part of the standard library but is relatively easy to obtain).linspace
takes a number of points to return, and also lets you specify whether or not to include the right endpoint:>>> np.linspace(0,1,11) array([ 0. , 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1. ]) >>> np.linspace(0,1,10,endpoint=False) array([ 0. , 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9])
If you really want to use a floating-point step value, you can, with
numpy.arange
.>>> import numpy as np >>> np.arange(0.0, 1.0, 0.1) array([ 0. , 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9])
Floating-point rounding error will cause problems, though. Here's a simple case where rounding error causes
arange
to produce a length-4 array when it should only produce 3 numbers:>>> numpy.arange(1, 1.3, 0.1) array([1. , 1.1, 1.2, 1.3])
相关问答
更多-
你在这里遇到的基本上是浮点运算背后的问题。 请参阅此问题以获取有关正在发生的事情及其发生原因的更多信息 。 总结一下,只需看看你的drange(0.1, 0.9, 0.1) : >>> list(drange(0.1, 0.9, 0.1)) [0.1, 0.2, 0.30000000000000004, 0.4, 0.5, 0.6, 0.7, 0.7999999999999999, 0.8999999999999999] 如您所见,您无法获得准确的结果。 因此,当你总结它们时,你将得不到精确的1 。 相反 ...
-
下列中不属于面向对象的编程语言的是?[2022-05-30]
a -
如果您正在查找0到1之间的随机数字列表,我认为您可能会很好地使用random模块 >>> import random >>> [random.random() for _ in range(0, 10)] [0.9445162222544106, 0.17063032908425135, 0.20110591438189673, 0.8392299590767177, 0.2841838551284578, 0.48562600723583027, 0.15468445000916797, 0.4314 ...
-
您还可以使用NumPy库(它不是标准库的一部分,但是相对容易获得),它具有以下功能: >>> import numpy as np >>> np.arange(0.0, 1.0, 0.1) array([ 0. , 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]) 以及linspace功能,可以控制端点发生的情况(当事情不会总是划分成正确数量的“slice”时,浮点数不是微不足道的): >>> np.linspace(0,1,11) array( ...
-
使用numpy的范围代替范围: import numpy as np for x in np.arange(0, 1, 0.1): print(x) use numpy's arange instead of range: import numpy as np for x in np.arange(0, 1, 0.1): print(x)
-
我想你将不得不使用JavaScript。 使用jQuery它将是: $('input').on('change', function() { var $this = $(this); if ($this.val() < 0.01) { $this.val('0.01'); } }); 的jsfiddle I think you're going to have to use JavaScript. With jQuery it would be: $('input').on('chan ...
-
带小数位的范围(Range with decimal place)[2022-12-13]
使用Range#cover执行此操作: if (9.74...9.78).cover? amounts count += 1 end 示例: p (9.74...9.78).cover? 9.75 # => true p (9.74...9.78).cover? 9.79 # => false 更新为@m_x建议 # will give you the element in the range array.select{ |item| (9.74..9.78).cover? item } # w ... -
十进制离子范围?(Decimal ion-range?)[2024-01-23]
离子范围圆步到积分。 val = Math.round(val); 因此,您有两种方法可以:修改“.. \ node_modules \ ionic-angular \ components \ range \”或进行解决方法。 例如,您可以使用ratio计算十进制值或设置max = 3000,然后在控制器中使用该值除以100.(假设您将2553作为值,然后当您将其除以100时得到25.53) ion-range round step to integral. val = Math.round(val); ... -
使用范围运算符和步(Using range operator with a step)[2022-05-08]
范围运算符本身不支持跳过/步进,但是如果运行的是4.0或更高版本,则可以使用Where-Object (或Where()方法来过滤掉每秒: PS C:\> (1..10).Where({$_ % 2 -eq 0}) 2 4 6 8 10 2.0及更高版本: PS C:\> 1..10 |Where-Object {$_ % 2 -eq 0} 2 4 6 8 10 The range operator itself doesn't support skipping/stepping, but you co ... -
在小数范围内搜索(Search within a decimal range)[2021-09-24]
也许我误会了,但你不能这样做吗? var a = {28.82:"a", 28.91:"b", 29.11:"c", 30.11:"d", 32.22:"e", 32.23:"f", 32.24:"g"}; function check(range){ if (a[range] || a[range+0.01] || a[range-0.01]){ // do stuff here... } } 或者你担心的方法太贵了? 注意逻辑检查if(a[range])如果a[ ...