【问题标题】:edit Text is not accepting numeric Keyboard in expendable ListVIew编辑文本不接受消耗性 ListVIew 中的数字键盘
【发布时间】:2016-05-17 12:29:58
【问题描述】:

这是我在 xml 中的代码

 <EditText
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:hint="0.00"
     android:inputType="number|numberDecimal"
     android:layout_marginRight="5dp"
     android:textSize="16dp"
     android:id="@+id/et_childinput1"
     android:background="#ffffff"
     android:imeOptions="actionDone"/>

我还尝试了 android:numeric="decimal" ,它被衍射了,我该怎么做。 我才知道

    android:numeric
    android:phoneNumber
    android:inputMethod
    android:capitalize
    android:autoText

android:inputType替换

上面的代码在编辑文本中对我有用,但是当它进入可消耗的列表视图子项时,问题出现了,键盘出现了,但在一个实例中,全键盘再次被数字替换 任何帮助将不胜感激

【问题讨论】:

  • 如果你想同时添加文本和数字值,你不需要应用 inputType ,如果你想让用户只输入数字值,保持 inputType "Numeric" 没有别的,或者使用 "numberDecimal" 如果你认为可以是小数,无需提及数字,只需写 numberDecimal

标签: android android-layout android-fragments android-studio


【解决方案1】:
<EditText
                android:id="@+id/phoneNoRegEdit"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="5dp"
                android:ems="15"
                android:hint="Phone"
                android:inputType="phone"
                android:maxLength="10"
                android:singleLine="true"
                android:textColorHint="@color/blue_home"/>

也许对你有帮助

【讨论】:

  • 你是对的,但是当我在消耗性列表视图中添加键盘时,数字键盘显示并立即被全键盘替换
【解决方案2】:

如果您只想要数字,那么它可能会对您有所帮助

<EditText
        android:id="@+id/phoneNoRegEdit"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="5dp"
        android:ems="15"
        android:hint="Phone"
        android:inputType="number"
        android:digits="01234567989"
        android:maxLength="10"
        android:singleLine="true"
        android:textColorHint="@color/blue_home"/>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-12-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多