gpt4 book ai didi

android - 在 android 4.0.3 中使用键盘时遇到困难?

转载 作者:行者123 更新时间:2023-11-29 13:58:50 26 4
gpt4 key购买 nike

我一直在开发一个应用程序屏幕,其中包含数字类型输入的编辑文本。它正常工作,发生的事情是——当用户触摸 editetxt 时,一个数字键盘打开,占据整个屏幕,当用户按下键盘中的下一步时,该键盘关闭,并弹出一个占据半屏的新键盘。

我不知道如何听键盘下一个按钮。

我真正想要的是如何禁用其中一个键盘。?我使用的代码很简单 edittext:

       <EditText
android:id="@+id/teedittext"
android:layout_width="85dip"
android:layout_height="wrap_content"
android:numeric="integer" >

</EditText>

请帮帮我,我是新手吗?我更喜欢禁用第一个键盘?

最佳答案

好的,我自己得到了答案这段代码 fragment 让我很开心:

    teedittext.setOnFocusChangeListener(new EditText.OnFocusChangeListener() {

@Override
public void onFocusChange(View v, boolean hasFocus) {
// TODO Auto-generated method stub
InputMethodManager imm =(InputMethodManager) getSystemService( INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(((EditText)findViewById(v.getId())).getWindowToken(), 0);
}

关于android - 在 android 4.0.3 中使用键盘时遇到困难?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10662854/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com