2011-05-07 45 views
0

我正在做一個非常簡單的測試應用程序,它使用文本到語音引擎並「說出」您放入EditText中的文本。它有一個EditText和一個Button。但是,當我嘗試在EditText中輸入文本時,只要輸入一個字母,它就會啓動Google搜索。有誰知道如何解決這一問題?奇怪的錯誤:EditText啓動Google搜索

更新:在使用它工作得很好物理鍵盤,所以我想這是與軟鍵盤的一個問題...

XML代碼:

<EditText android:id="@+id/etText" android:layout_width="fill_parent" 
android:layout_height="fill_parent" android:gravity="top" 
android:layout_marginTop="5dip" android:layout_marginLeft="2dip" 
android:layout_marginRight="2dip" android:inputType="text"> 
</EditText> 
+0

也許你可以嘗試發佈一些你的代碼。 – Tony 2011-05-07 15:07:50

+0

沒有編輯框的代碼 – JoeyCK 2011-05-07 20:44:16

+0

你需要編輯文本框的代碼,以及它的XML佈局 – Blundell 2011-05-07 20:47:01

回答

0

我遇到了同樣的問題當我有一個未使用的OnClickListener

在重構代碼中,我發現我留下了空的onClickListeneronClick方法。刪除implements OnClickListener和包含public void onClick(View view)項目的方法,我再也沒有讓搜索框出現在我的editText點擊事件中。這看起來很奇怪,但它對我有用!

此外,我除去以下行:

getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); 
1

中的EditText上,並在活動呼籲editTextFieid.requestFocus()佈局XML設置android:inputType="text"解決了這個問題對我來說。 此問題僅出現在活動中的第一個EditText中。這是我的情況下用戶名EditText。