2013-06-05 48 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