2014-01-29 145 views
3

我是Android开发的新手。最近,我在我的应用程序中使用的EditTexts中遇到了一个问题,我目前正在Emulator中运行它。点击EditText它会获得焦点,但是在输入某些我无法输入值时。Android EditText - 无法输入值

任何帮助将是可观的。

<LinearLayout 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:orientation="horizontal" 
    android:padding="0dp" 
    android:weightSum="1" > 

    <TextView 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:layout_weight=".25" 
     android:text="@string/amt" 
     android:textSize="15sp" /> 

    <EditText 
     android:id="@+id/amount" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginLeft="10dp" 
     android:background="@drawable/edit_text" 
     android:inputType="number" /> 
</LinearLayout> 
+0

你能看到光标吗? –

+4

设置inputType =“number”只允许输入数字。你能做到吗? – spezzino

+1

我认为你的代码是正确的,所以我会建议在你的设备上试用它,可能会有效。 – Rajan

回答

2

从XML文件删除此行

android:inputType="number" 

,如果你想进入任何然后设置输入类型的EditText

android:inputType="textNoSuggestions" 
+0

非常感谢你哦....它的工作 – indu

+0

你能解释如何使输入类型“textNoSuggestions”将允许我们输入编辑文本@Piyush Guptha – gman

0

删除这一行android:inputType="number",它现在应该工作