Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
edittext专注于android中的可视性_Android_Android Edittext_Visibility - Fatal编程技术网

edittext专注于android中的可视性

edittext专注于android中的可视性,android,android-edittext,visibility,Android,Android Edittext,Visibility,我有一个edittext。它是由defalut不可见的。单击列表项它是可见的。我想在它可见时聚焦编辑文本。并打开软键盘。我有很多搜索,但它不处理可见和不可见。 代码: public void onItemClick(适配器视图arg0、视图arg1、内部arg2、, 长arg3){ list_selection=((TextView)arg1.getText().toString(); 如果(列表_选择等于(“其他”)) { 编辑_other.setVisibility(View.VISIBLE

我有一个edittext。它是由defalut不可见的。单击列表项它是可见的。我想在它可见时聚焦编辑文本。并打开软键盘。我有很多搜索,但它不处理可见和不可见。 代码:

public void onItemClick(适配器视图arg0、视图arg1、内部arg2、,
长arg3){
list_selection=((TextView)arg1.getText().toString();
如果(列表_选择等于(“其他”))
{
编辑_other.setVisibility(View.VISIBLE);
编辑_other.setFocusable(true);
编辑_other.setCursorVisible(true);
其他.setVisibility(View.VISIBLE);
image.setVisibility(View.VISIBLE);
((InputMethodManager)getSystemService(Context.INPUT\u METHOD\u SERVICE)).toggleSoftInput(InputMethodManager.SHOW\u强制,InputMethodManager.HIDE\u仅隐式);
}
尝试使用

edit_other.requestFocus();

您可以试试看:

 if(edit_other.requestFocus()) {
     getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
 }

希望有帮助!

谢谢你。我尝试了dis。((InputMethodManager)getSystemService(Context.INPUT\u METHOD\u SERVICE))。切换SoftInput(InputMethodManager.SHOW\u强制,InputMethodManager.HIDE\u仅限隐式);是的。如果条件存在,我将丢失。
 if(edit_other.requestFocus()) {
     getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
 }