Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/208.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 两个或多个AutoCompleteTextView不工作_Android_Autocompletetextview - Fatal编程技术网

Android 两个或多个AutoCompleteTextView不工作

Android 两个或多个AutoCompleteTextView不工作,android,autocompletetextview,Android,Autocompletetextview,我是一名网络开发人员,试图用3个AutoCompleteTextView在Android应用程序中实现一个逻辑。我尝试了一个AutoCompleteTextView,它工作正常。当我有3个AutoCompleteTextView时,它不工作。请帮我做这个 这是我的布局代码 <AutoCompleteTextView android:id="@+id/textExecutive" android:layout_width="match_parent"

我是一名网络开发人员,试图用3个AutoCompleteTextView在Android应用程序中实现一个逻辑。我尝试了一个AutoCompleteTextView,它工作正常。当我有3个AutoCompleteTextView时,它不工作。请帮我做这个

这是我的布局代码

<AutoCompleteTextView  android:id="@+id/textExecutive"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="@string/hint_executive" />
<AutoCompleteTextView  android:id="@+id/textSupervisor"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="@string/hint_supervisor" />
<AutoCompleteTextView  android:id="@+id/textManager"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="@string/hint_manager" />

这是onCreate

textExecutive = (AutoCompleteTextView) findViewById(R.id.textExecutive);
    textSupervisor= (AutoCompleteTextView) findViewById(R.id.textSupervisor);
    textManager= (AutoCompleteTextView) findViewById(R.id.textManager);

String[] executives = getResources().getStringArray(R.array.executives_array);
    String[] supervisors = getResources().getStringArray(R.array.supervisors_array);
    String[] managers = getResources().getStringArray(R.array.managers_array);


ArrayAdapter<String> executivesAdapter =
            new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, executives);

    ArrayAdapter<String> supervisorsAdapter =
            new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, supervisors);

    ArrayAdapter<String> managersAdapter =
            new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, managers);

textExecutive.setAdapter(celebritiesAdapter);
    textSupervisor.setAdapter(eventsAdapter);
    textManager.setAdapter(itemsAdapter);
textExecutive=(AutoCompleteTextView)findViewById(R.id.textExecutive);
textSupervisor=(AutoCompleteTextView)findViewById(R.id.textSupervisor);
textManager=(AutoCompleteTextView)findviewbyd(R.id.textManager);
String[]executies=getResources().getStringArray(R.array.executies\u array);
String[]supervisors=getResources().getStringArray(R.array.supervisors\u数组);
String[]managers=getResources().getStringArray(R.array.managers\u数组);
ArrayAdapter执行适配器=
新的ArrayAdapter(这是android.R.layout.simple_list_item_1,高管);
阵列适配器管理器适配器=
新的ArrayAdapter(这是android.R.layout.simple_list_item_1,supervisors);
阵列适配器管理器适配器=
新的ArrayAdapter(这是android.R.layout.simple\u list\u item\u 1,管理器);
textExecutive.setAdapter(celebritiesAdapter);
textSupervisor.setAdapter(eventsAdapter);
setAdapter(itemsAdapter);
您可以尝试

 textExecutive.setOnTouchListener(new OnTouchListener() {

            @Override
            public boolean onTouch(View paramView, MotionEvent paramMotionEvent) {
                // TODO Auto-generated method stub
                textExecutive.showDropDown();
                textExecutive.requestFocus();
                return false;
            }
        });

其他两个也一样

您遇到了什么样的错误?没有错误。“自动完成”过程不起作用“不起作用”意味着什么?键入相应数组中的任何文本,使用一个“自动完成文本视图”,带建议的下拉列表正常工作。但是当有2到3个AutoCompleteTextView时,我没有得到任何建议