使用键盘stateAlwaysVisible,触摸任何字母后的"选取[按钮,为什么? [英] Using keyboard with stateAlwaysVisible, after touch any letter its "select" the button, why?

查看:161
本文介绍了使用键盘stateAlwaysVisible,触摸任何字母后的"选取[按钮,为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只有一个按钮,在我的布局与活动无关。在清单它有机器人:windowSoftInputMode =stateAlwaysVisible的活动,总是显示键盘

问题是,当触摸键盘上的任意键只有一个按钮选择一种。在蓝色的像突出了整个按钮。

不过,我不希望这种行为,我怎么能避免呢?

对不起,我不能添加,因为我的名气图片...

下面是我的codeS:

清单:

 <活动
   机器人:名字=。MainActivityTest
   机器人:windowSoftInputMode =stateAlwaysVisible>
< /活性GT;

活动:

 公共类MainActivityTest延伸活动{       @覆盖
       保护无效的onCreate(捆绑savedInstanceState){
           super.onCreate(savedInstanceState);
           的setContentView(R.layout.activity_main_activity_test);
       }
    }

布局:

 < LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    机器人:layout_width =match_parent
    机器人:layout_height =match_parent>    <按钮
        机器人:ID =@ + ID / bt_testButton
        机器人:layout_width =WRAP_CONTENT
        机器人:layout_height =WRAP_CONTENT
        机器人:文字=按钮/>< / LinearLayout中>


解决方案

下面的属性添加到您的LinearLayout可避免此行为:

 机器人:可聚焦=真
  机器人:focusableInTouchMode =真

我曾尝试和它工作得很好。

I have only one button in my layout and the activity has nothing. On Manifest it has the android:windowSoftInputMode="stateAlwaysVisible" for the activity, to always show the keyboard.

The problem is that when touch any key on keyboard the only one button is kind selected. Like "highlighted" the entire button in blue.

But I don't want this behavior, how can I avoid it?

Sorry I can not add images because of my reputation...

Below are my codes:

Manifest:

<activity
   android:name=".MainActivityTest"
   android:windowSoftInputMode="stateAlwaysVisible">
</activity>

Activity:

    public class MainActivityTest extends Activity {

       @Override
       protected void onCreate(Bundle savedInstanceState) {
           super.onCreate(savedInstanceState);
           setContentView(R.layout.activity_main_activity_test);
       }
    }

Layout:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <Button
        android:id="@+id/bt_testButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Button" />

</LinearLayout>

解决方案

Add the following attribute to your LinearLayout can avoid this behavior:

  android:focusable="true"
  android:focusableInTouchMode="true"

I have tried and it works well.

这篇关于使用键盘stateAlwaysVisible,触摸任何字母后的&QUOT;选取[按钮,为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆