android编辑文本不接受numric输入

时间:2015-09-27 08:18:12

标签: android

我正在开发Android应用程序这个问题我从昨天开始就被困住了,我不知道是什么问题。

编辑文字没有数字输入。我的XML代码

<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:padding="@dimen/dp5">

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="@dimen/dp15"
    android:orientation="horizontal"
    android:weightSum="2">

    <EditText
        android:id="@+id/home_et_code"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1.3"
        android:hint="@string/code_number"
        android:inputType="number"
        android:maxLength="18"
        android:maxLines="1" />

    <Button
        android:id="@+id/home_btn_charge"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="0.7"
        android:text="@string/charge"
        android:textAppearance="?android:attr/textAppearanceButton"
        android:textColor="@color/white"
        android:textStyle="bold" />
</LinearLayout></LinearLayout>

如果我删除android:inputType="number"然后它开始工作并接受输入,但我需要编辑文本只接受数字输入。

我还没有在java中处理任何事情。所以不需要添加java代码。

注意:它在android&gt;上工作正常14,但在Gingerbread设备上会出现问题 有什么问题?

2 个答案:

答案 0 :(得分:0)

fig, ax = subplots(1,2, sharey = true)
ax[1,1][:plot](unit_x, unit_y)
ax[2,1][:plot](transf[:, 1], transf[:, 2])

尝试将此行放在您的edittext上

答案 1 :(得分:0)

现在它工作正常,因为我更新了android sdk平台我注意到很多问题,如编辑文本输入也没有在代码中检测到按钮按下。但我所要做的就是关闭android studio并重新打开它然后编译我的应用程序。最后再次运作!!

相关问题