我正在使用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)
{
}
});
}
});
}