2013-06-05 53 views
0

我有一些文本视图和编辑文本的线性布局,出于某种原因,当我在模拟器输入到编辑文本运行正常,但不是在设备上。当我输入编辑文本时,文本不会出现在编辑文本框中。这里的布局:编辑文字不允许键盘输入设备上?

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

<TextView 
    android:text="Complete Order Form" 
    android:textSize="20dp" 
    android:textStyle="bold" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_weight="0.25" 
    android:gravity="center"/> 

<TextView 
    android:text="Enter Name: " 
    android:textSize="20dp" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_weight=".25"/> 

<EditText 
    android:id="@+id/nameEdit" 
    android:hint="Name" 
    android:layout_width="match_parent" 
    android:layout_weight=".25" 
    android:layout_height="wrap_content" /> 

<TextView 
    android:text="Enter Address:" 
    android:textSize ="20dp" 
    android:layout_width="match_parent" 
    android:layout_weight=".25" 
    android:layout_height="wrap_content" /> 

<EditText 
    android:id="@+id/addressEdit" 
    android:hint="Address" 
    android:layout_weight=".25" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" /> 

<TextView 
    android:text="Enter Phone: " 
    android:textSize="20dp" 
    android:layout_width="match_parent" 
    android:layout_weight=".25" 
    android:layout_height="wrap_content" /> 

<EditText 
    android:id="@+id/phoneNoEdit" 
    android:hint="Phone" 
    android:layout_width="match_parent" 
    android:layout_weight=".25" 
    android:layout_height="wrap_content" /> 

<TextView 
    android:text="Enter Order Comments: " 
    android:textSize="20dp" 
    android:layout_width="match_parent" 
    android:layout_weight=".25" 
    android:layout_height="wrap_content"/> 

<EditText 
    android:id="@+id/comments" 
    android:hint="Comments" 
    android:layout_width="match_parent" 
    android:layout_weight=".25" 
    android:layout_height="wrap_content" /> 

<Button 
    android:id="@+id/sendOrder" 
    android:text="Continue to Payment" 
    android:layout_width="match_parent" 
    android:layout_weight=".25" 
    android:layout_height="wrap_content" /> 

<Button 
android:id="@+id/dontSend" 
    android:layout_width="match_parent" 
    android:layout_weight=".25" 
    android:layout_height="wrap_content" 
    android:text="Cancel" /> 

</LinearLayout> 

回答

0

你的问题有点钝,所以我的答案也是钝的。如果您在使用模拟器键盘输入时未在文本框中显示文本,那么它就是模拟器。要解决此问题,请编辑仿真器并启用硬件。

另外:你有一个相应的Java类,每个元素都有一个ActionListener(包括EditText)?从那里,您可以使用诸如getText()等方法。

我会根据需要进行编辑。

+0

的排序。当我在仿真器上运行它时,它工作正常,所以我知道仿真器不是问题。当我在实际设备上运行活动时,文本不会显示在框中。我试过改变设备上的输入法 – ACanicatti

+0

文本没有出现在EditText框中?我的意思是文本字段中的文本带有一个字符串,如“密码”。这是不是出现? – user1546859

+0

我得到它的工作,我已经错误地切换了文本视图的编号和编辑文本。无论如何感谢 – ACanicatti