私は奇妙な問題に遭遇しました。これは私がEdittextに使用したコードです
<EditText
android:id="@+id/editText1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="textMultiLine"
android:singleLine="false" />
アプリを実行し、編集テキストに何かを入力し始めるたびに。Google 検索ウィジェットが表示され、入力した文字に基づいて結果が表示され始めます。私はこのためのコードを書きませんでした。
ここで、アクティビティの onCreate メソッドを投稿しています。
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
// progress dialog
progressDialog = ProgressDialog.show(this, "", "Loading. Please wait...", false);
progressDialog.hide();
final Spinner spinnerLanguage = (Spinner)this.findViewById(R.id.spinner1);
final EditText edittextSource = EditText)this.findViewById(R.id.editText1);
final EditText edittextInput = (EditText)this.findViewById(R.id.editText2);
final Activity activity = this;
textOutput = (TextView)this.findViewById(R.id.textView3);
textResult = (TextView)this.findViewById(R.id.textView4);
// languages
spinnerLanguage.setAdapter(new AdapterLanguages(this, 1));
// execute button
Button btnExecute = (Button)this.findViewById(R.id.button1);
btnExecute.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
//some code here
}
});
}
edittext1に何か入力するとすぐに、次の意図が発生します
アクティビティの開始: Intent { act=android.search.action.GLOBAL_SEARCH flg=0x10000000 cmp=com.google.android.googlequicksearchbox/.SearchActivity (エキストラあり) }