繁体   English   中英

三星设备打开错误的键盘

[英]Samsung Devices opens Wrong Keybaord

下面的代码在一些三星设备上打开数字键盘,设备包括三星 s7 Edge、A9。

           <EditText
                    android:id="@+id/prdtName"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="@string/Product"
                    android:text="@={product.productName}"
                    android:singleLine="true"
                    android:background="@drawable/edittext"
                    android:padding="15dp"
                    android:layout_margin="10dp"
                    bind:font="@{AppConstants.OpenSansRegular}"
                    android:inputType="textCapWords"
                    />

在此处输入图像描述

您能否添加您测试过的设备的 android 版本?

据我了解,您想打开键盘并允许用户只输入大写字母。 有多种方法可以做到:

android:inputType="textCapSentences"将适用于请求每个句子的第一个字符大写的句子。

android:inputType="textCapCharacters"请求所有字符大写。

android:inputType="textCapWords"请求每个单词的第一个字符大写。 这些可以与文本及其变体(如 textPersonName、textPostalAddress、textShortMessage 等)结合使用...

例如: android:inputType="textCapWords|textCapSentences"android:inputType="textPostalAddress|textCapSentences"

检查文档: https://developer.android.com/reference/android/widget/TextView.html#attr_android:inputType

或者您可以以编程方式执行此操作:

EditText input = (EditText).findViewById(R.id.ID);
input.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);

您也可以使用android:capitalize ,它适用于某些情况,并且应该自动将用户键入的内容大写。

android:inputType="none" ,它不会自动大写任何东西。

android:inputType="sentences" ,它将大写每个句子的第一个单词。

android:inputType="words" ,它将大写每个单词的第一个字母。

android:inputType="characters" ,它将大写每个字符。

如果所有这些建议都对您不起作用,那么这是三星设备和某些特定 android 版本的问题。 尝试通过此处建议的键盘设置解决此问题: https://stackoverflow.com/a/31699306/12802591

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM