EditText上没有显示虚拟键盘

EditText上没有显示虚拟键盘

本文介绍了EditText上没有显示虚拟键盘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了一个EDITTEXT动态画面的it..but后单击它没有显示已经添加了这些之后codes..but仍然OT工作的虚拟keyboard.I。

<$p$p><$c$c>getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);

这也力工作

  InputMethodManager IM =(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);

im.showSoftInput(EditText上,0);

我的code是这里...

  runOnUiThread(新的Runnable(){
            公共无效的run(){
                的LinearLayout findViewById =(的LinearLayout)findViewById(R.id.dynamicInputs);
                // TextView中的TextView =(的TextView)findViewById(R.id.name);
                TextView中的TextView =新的TextView(Activity_UserInput.this);
                textView.setText(+ map.get(KEY_NAME)+:);
                textView.setTextColor(Color.BLACK);
                textView.setTextSize(TypedValue.COMPLEX_UNIT_SP,17);
                //textView.setLayoutParams(new的LayoutParams(Layout.DIR_LEFT_TO_RIGHT,Gravity.CENTER_VERTICAL));                findViewById.addView(TextView的);                EDITTEXT的EditText =新的EditText(Activity_UserInput.this);
                editText.setText();
                //editText.setInputType(InputType.TYPE_CLASS_NUMBER);                findViewById.addView(EDITTEXT);            }


解决方案

让我试试,我认为你需要在EDITTEXT喜欢将焦点设置..

  editText.setFocusableInTouchMode(真);
    editText.requestFocus();

我不知道,但尝试,让我知道它的工作原理与否。

I have created a dynamic screen with editText in it..but after click it is not showing the virtual keyboard.I have added these following codes..but still ot worked.

getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);

and this also dint worked

InputMethodManager im = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);

im.showSoftInput(edittext, 0);

my code is here...

runOnUiThread(new Runnable() {
            public void run() {
                LinearLayout findViewById = (LinearLayout) findViewById(R.id.dynamicInputs);
                //TextView textView = (TextView) findViewById(R.id.name);
                TextView textView = new TextView(Activity_UserInput.this);
                textView.setText("   " + map.get(KEY_NAME) + " :");
                textView.setTextColor(Color.BLACK);
                textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 17);
                //textView.setLayoutParams(new LayoutParams(Layout.DIR_LEFT_TO_RIGHT, Gravity.CENTER_VERTICAL));

                findViewById.addView(textView);

                EditText editText = new EditText(Activity_UserInput.this);
                editText.setText("");
                //editText.setInputType(InputType.TYPE_CLASS_NUMBER);

                findViewById.addView(editText);

            }
解决方案

Let me try, I think you need to set focus on editText like..

    editText.setFocusableInTouchMode(true);
    editText.requestFocus();

I am not sure but try it and let me know it works or not.

这篇关于EditText上没有显示虚拟键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 21:40