Android的按键需要两个点击动作按键、动作、两个、Android

2023-09-06 07:59:22 作者:__い一辈子、谈何容易

我有一个表格。 7 EditText上的垂直布局。在屏幕上的一个时刻只能看到3的EditText(形式为大,所以我需要上下滚动来填充个行业)。在底部 - 按钮

I have a form. 7 EditText in vertical layout. On screen in one moment can see only 3 EditText (form is big so I need to scroll up and down to fill all fileds). In bottom - Button.

当我填写上面的EditText(或顶部之一,至极是无形的,当我向下滚动按钮),焦点(光标)在这个EditText上,当我向下滚动,并尝试点击按钮一次 - 什么也没有发生。当我再次点击 - 发生按钮操作

When I fill top EditText (or one of top, wich is invisible when I scrolled down to button), and focus (cursor) in this EditText, when I scrolled down and try to click Button once - nothing happens. when I click again - happens button action.

当两者的EditText重点和按钮可见 - 巴顿需要1点击

When both EditText with focus and Button is visible - Button needs one clicks.

我认为,在第一种情况下先单击只需要关注。而第二次点击是真实的点击。

I think that in first case first click just takes focus. And second click is "real" click.

我怎样才能解决这个问题?我只需要点击按钮。谢谢

How I can fix it? I need only one click on Button. Thanks

推荐答案

现在的问题是旧的,我不知道这是否会解决你的问题,因为你的引擎收录的链接不工作了,但因为我无意中发现你的张贴着同样的问题,我找到了一个解决办法,我反正会发布它:

The question is old and I don't know whether this will solve your problem, since your pastebin link doesn't work anymore, but since I stumbled upon your post with the same problem and I found a solution I will post it anyway:

在我的情况下,问题发生时,我应用自定义样式下面的教程一个按钮:

In my case the problem occured when I applied a custom style to a button following a tutorial:

<style name="ButtonStyle" parent="@android:style/Widget.Holo.Button">
    <item name="android:focusable">true</item>
    <item name="android:focusableInTouchMode">true</item>
    <item name="android:clickable">true</item>
    <item name="android:background">@drawable/custom_button</item>
    <item name="android:textColor">@color/somecolor</item>
    <item name="android:gravity">center</item>
</style>

问题是以下行:

The problem was the following line:

<item name="android:focusableInTouchMode">true</item>

在我删除它的按钮都按预期。

Once I removed it the button worked as expected.

希望这有助于。