我有一些文本视图和编辑文本线性布局,由于某种原因,当我在模拟器上运行输入编辑文本工作正常,但不在设备上。当我输入编辑文本时,文本不会出现在编辑文本框中。下面是布局:
<?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>
你的问题有点生硬,所以我的回答也会生硬。如果您谈论的是当您使用模拟器键盘键入时文本未出现在框中,那么它就是模拟器。要解决这个问题,请编辑模拟器并启用硬件。
也:你有一个相应的Java类,有一个ActionListener为每个元素(包括EditText)?从这里,您可以使用getText()
等方法。
我将根据需要进行编辑