autoCompleteTextView项目添加图标

时间:2019-07-02 14:50:30

标签: android

我正在使用autoCompleteTextView。我想在添加到autocompletetextview的项目旁边放置图标。如何在每次按下按钮时放置图标?

public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener, OnItemSelectedListener, View.OnTouchListener, RadioGroup.OnCheckedChangeListener
{
    final AutoCompleteTextView textViewLocationUpdate;
    textViewLocationUpdate = (AutoCompleteTextView)findViewById(R.id.txtDeviceUpdate);
    textViewLocationUpdate.setAdapter(arrayAdapterLocation);
    textViewLocationUpdate.setOnClickListener(new View.OnClickListener()
    {
        @Override
        public void onClick(final View arg0)
        {
            textViewLocationUpdate.showDropDown();
        }
    });

    textViewLocationUpdate.setOnItemClickListener(new OnItemClickListener()
    {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id)
        {
            final String selected = (String)parent.getItemAtPosition(position);
            refDeviceName.child("title").addListenerForSingleValueEvent(new ValueEventListener()
            {
                @Override
                public void onDataChange(DataSnapshot dataSnapshot)
                {
                    dataSnapshot.getRef().setValue(selected);
                }
                @Override
                public void onCancelled(DatabaseError databaseError)
                {
                }
            });
        }
    });
}

0 个答案:

没有答案