有什么方法可以从 java 类更改 android:windowSoftInputMode 值? [英] Is there any way to change android:windowSoftInputMode value from java class?

查看:31
本文介绍了有什么方法可以从 java 类更改 android:windowSoftInputMode 值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想让我的选项卡为每个选项卡设置不同的 windowSoftInputMode 属性.当您的选项卡的所有处理都通过一个活动完成时,如何从 Java 类访问此属性?

I want to act my tabs to have different windowSoftInputMode properties for each tab. How to access this property from java class when all handling of your tab is done from one single activity?

有没有办法从 java 代码访问这个清单属性?

Is there any way to access this manifest property from java code?

推荐答案

使用以下内容更改 Activity 的 softInputMode.

Use the following to change the softInputMode for an Activity.

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

使用以下命令更改 EditText 的 softInput 类型.

Use the following to change the softInput type for an EditText.

mEditText.setImeOptions(EditorInfo.IME_ACTION_DONE);

感谢@Eliezer 的更正

Thanks to @Eliezer for correction

这篇关于有什么方法可以从 java 类更改 android:windowSoftInputMode 值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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