Android EditText控件的大写字母被卡住了
我有一个布局,我正在将EditText控件的输入类型设置为android:inputType=“textCapCharacters”。在这个控件上可以很好地工作,但随后会继续工作,甚至将大写属性带到其他应用程序中 2.1英雄和2.3野火的情况似乎就是这样 有没有关于如何取消它的锁定或将键盘设置回默认模式的建议 多谢各位 下面是一个代码片段,它展示了大写字母卡住的行为。我无法想象我是唯一一个有过这个问题的人 点击地址第1行,大写的单词就可以了。聚焦邮政编码时,键盘将正确切换为大写,但无论您关注的是其他控件(例如,单击返回地址行1),即使您转到其他应用程序,键盘仍将保持大写 应该注意的是,代码似乎在模拟器中按预期工作,并且它仅在物理设备上以大写字母锁定 我现在知道,至少在英雄身上,问题只存在于普通键盘上。使用快捷键键盘时,一切似乎都很好 我已经在另外两个论坛上发布了这个问题,没有回应,但是Stackoverflow似乎是这类查询的最佳建议,但是8天后,我也没有任何关于我可以在这里尝试什么的建议。如果更多的信息,不同的标签,或张贴在其他地方对我来说是一个更好的选择,我也会很高兴听到这些建议 下面包含显示错误的完整代码 有什么建议吗Android EditText控件的大写字母被卡住了,android,android-layout,android-edittext,uppercase,Android,Android Layout,Android Edittext,Uppercase,我有一个布局,我正在将EditText控件的输入类型设置为android:inputType=“textCapCharacters”。在这个控件上可以很好地工作,但随后会继续工作,甚至将大写属性带到其他应用程序中 2.1英雄和2.3野火的情况似乎就是这样 有没有关于如何取消它的锁定或将键盘设置回默认模式的建议 多谢各位 下面是一个代码片段,它展示了大写字母卡住的行为。我无法想象我是唯一一个有过这个问题的人 点击地址第1行,大写的单词就可以了。聚焦邮政编码时,键盘将正确切换为大写,但无论您关注的是
import android.app.Activity;
import android.os.Bundle;
public class Main extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent" android:layout_width="fill_parent">
<TableLayout android:layout_width="fill_parent" android:id="@+id/tableLayout1"
android:layout_height="fill_parent" android:layout_margin="5dp"
android:stretchColumns="1">
<TableRow>
<EditText android:textSize="17sp" android:layout_height="39dp"
android:layout_width="fill_parent" android:id="@+id/address"
android:hint="Address Line 1" android:layout_span="3"
android:inputType="textCapWords"></EditText>
</TableRow>
<TableRow>
<EditText android:inputType="textCapCharacters"
android:textSize="17sp" android:id="@+id/postcode"
android:layout_height="39dp" android:hint="Postcode"
android:layout_weight="1" android:layout_width="0dip"></EditText>
<CheckBox android:text="Check Me"
android:layout_height="39dp" android:id="@+id/checkme"
android:textSize="12sp" android:layout_weight="1"
android:layout_span="2" android:layout_width="0dip"
android:layout_gravity="center"></CheckBox>
<TextView android:layout_weight="1" android:layout_width="0dip"></TextView>
</TableRow>
</TableLayout>
</LinearLayout>
导入android.app.Activity;
导入android.os.Bundle;
公共类主要扩展活动{
/**在首次创建活动时调用*/
@凌驾
创建时的公共void(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
如果您想显示带大写字母的键盘,则可以使用android:inputType=“textCapCharacters”
,而不是使用android:textAllCaps=“true”
。那么您的文件将不会坚持大写格式。然后,为了确保输入是大写的,您可以对从EditText检索到的字符串调用toUpperCase()
方法。让我知道你对此的想法 遇到相同的问题,未找到解决方案:(