position

getSelectedItemPosition() of a spinner always returns 0

左心房为你撑大大i 提交于 2019-12-10 17:14:21
问题 I'm trying to make the alert box show the selected item on the spinner and I'll need the position later on the code. I tested and the spiAli.getSelectedItemPosition() only returns 0 even before the switch. Here is my string: private static final String[] listaAlimentos = {"Arroz","Feijão","Bife"}; ArrayAdapter<String> alistaAlimentos; And the function that's not working: butFinalizar.setOnClickListener(new View.OnClickListener() { public void onClick(View arg0) { String escolhaAlimento = null

JavaScript get position of option element?

蓝咒 提交于 2019-12-10 16:13:17
问题 I have a web app that needs to know the position (x/y not index!) of an option element inside a multi select list. It works great in Firefox but no dice in Chrome or IE. Is it possible to get an option's position in Chrome/IE with JavaScript? Here is my fiddle displaying the issue: http://jsfiddle.net/jamiller619/Kbh4g/3/ Works with Firefox but not in IE/Chrome. 回答1: Short answer - you can't (webkit issue). But you can cheat!!! HTML: <div style="position:relative"> <select multiple="multiple"

Problems changing the position of an ImageView in Android

主宰稳场 提交于 2019-12-10 16:09:14
问题 I cannot seem to change the position of an ImageView in my android application. It happens when I place my code in a specific method as explained below. I am using the IndoorAtlas library in my android project. I downloaded the sample application and got it running on my phone. Works great. This library has an onServiceUpdate method which is used to handle the location updates. My aim is to move an ImageView whenever the location is updated. Pretty simple. Here is the original method as

SQLite: How to select part of string?

别等时光非礼了梦想. 提交于 2019-12-10 15:58:43
问题 There is table column containing file names: image1.jpg, image12.png, script.php, .htaccess,... I need to select the file extentions only. I would prefer to do that way: SELECT DISTINCT SUBSTR(column,INSTR('.',column)+1) FROM table but INSTR isn't supported in my version of SQLite. Is there way to realize it without using INSTR function? 回答1: below is the query (Tested and verified) for selecting the file extentions only. Your filename can contain any number of . charenters - still it will

追溯源码解决android疑难问题1--Viewpager之notifyDataSetChanged

折月煮酒 提交于 2019-12-10 15:57:56
最近项目结束,搞了一次代码分享。其中一位同学分享了一下自己在解决问题过程中的一些心得体会,感觉受益匪浅。整理出来,分享给大家。 建议使用自己编译的android os和虚拟机,这样就可以调试android系统中的任何组件。简单说来,深入android源码,去寻找解决问题的答。这事儿说起来简单,实际做起来还是有些难度的。我也曾经尝试着去看过,没看一会儿就晕了。 所以还是有针对性的去看源码,效率会高一些。 废话不多说,先看第一个示例。 Viewpager在调用notifyDataSetChanged()时,界面无刷新。 相信很多做过Viewpager的同学肯定遇到过这个问题,这个是bug还是android就是如此设计的,我们不做讨论。总之,它确实影响我们功能的实现了。 可能不少同学选择为Viewpager重新设置一遍适配器adapter,达到刷新的目的。但是这种方法在大多数情况下,是有问题的。 追踪源代码: 为什么调用数据更新的方法,Viewpager却没有更新呢,我们跟进该方法的源代码看一下。 首先查看适配器调用的super.notifyDataSetChanged(),该方法调到抽象基类PagerAdapter.notifyDataSetChanged()中: [java] view plain copy /** * This method should be called by

Absolute Positioning with Footer not working

亡梦爱人 提交于 2019-12-10 15:19:57
问题 I have no idea how to fix this. Putting things on position: relative will null out the bottom: 0px, and will also create tons of white space on pages that don't fit the entire height due to lack of content. Putting it on absolute makes it cover content of pages that do have content long enough to generate a scroll bar. .footer { width: 100%; height: 150px; background: #3167b1; position: absolute; bottom: 0px; } This should be working right? For some reason it just doesn't. Is it Wordpress?

CSS position absolute - next positioned element is body?

做~自己de王妃 提交于 2019-12-10 15:05:23
问题 Quoting from msdn : "Object is positioned relative to parent element's position— or to the body object if its parent element is not positioned " Lets say I set a div with certain dimension to bottom 0; and left: 0; it will not be positioned at the bottom of body but at bottom left of viewport . Also when giving body a margin - the div will still be at bottom left of viewport . I know how to work with these properties but I am looking for reasoning. Is it not the body to which the absolute

c# absolute position of control on screen

穿精又带淫゛_ 提交于 2019-12-10 14:59:48
问题 I'm trying to get the absolute position of a control on the screen. I'm using two monitors and the results aren't really that great... What I'm doing is opening another form to capture an image, then passing this image to the main form and closing the capture form. I then want the main form to appear in the same place the picture was captured. To get a gist of what I'm trying to do as an example, open Snipping Tool on Windows and capture a snip. The window will then appear in the place that

Small dead space on a div button in chrome

霸气de小男生 提交于 2019-12-10 14:34:31
问题 I can't explain this one. I've got a div that's a button. I use the :active psuedo class and position: relative; to move it slightly down and to the right when clicked, to give it an animation. For some reason, there is a small dead space on this button in Chrome about half way between the text and edge of the button. The psuedo class still fires but the Javascript on the button does not. If I remove the position relative, the problem goes away. This also happens in Firefox, but the deadspace

【互动编程习作】振荡——振荡的实现及其应用

浪尽此生 提交于 2019-12-10 14:24:26
前言 在《代码本色》的第3章 振荡 中,主要讲到了三角函数的运动形式体现振荡以及力的作用模拟自然系统,以下为第3章的内容目录: 针对三角函数的运动形式体现振荡以及加速旋转和力的作用模拟自然系统,我进行了自己的习作。 关于习作 学习了《代码本色》第3章的内容之后,关于习作,我想表现的元素就是: 三角函数波形运动 加速旋转效果 力的作用模拟自然系统 关于第一点,我使用了动态的波形曲线体现三角函数的运动,颜色会随着位置和时间变化,波也在不停地变化。 关于第二点,我用的是一个加速旋转的两圆头棒子,从屏幕左上角平移到屏幕中间,进行加速旋转,再将屏幕平移会原先位置,旋转效果中和,进行其他操作。 关于第三点,做的就是一个弹力系统,可以鼠标点击拉动小球,显现弹力效果。 下面是效果图和具体代码实现: Mover.pde class Bob { PVector position ; PVector velocity ; PVector acceleration ; float mass = 24 ; // Arbitrary damping to simulate friction / drag float damping = 0.98 ; // For mouse interaction PVector dragOffset ; boolean dragging = false ; //