5

I am using AutoCompleteTextView (ref : AutoCompleteTextView )

I am able to get list of auto suggestion provided by this view.

Now I want to disable the second suggestion from this view.

Can you please tell me how to achieve it ? Thanks

Community
  • 1
  • 1
Pratik
  • 1,531
  • 3
  • 25
  • 57

1 Answers1

4

Create a custom data adapter for your AutoCompleteTextView by extending ArrayAdapter and then override isEnabled method from that custom adapter to define which items are click-able or not.

@Override
public boolean isEnabled(int position) {
    // TODO Auto-generated method stub
    return super.isEnabled(position);
}
waqaslam
  • 67,549
  • 16
  • 165
  • 178
  • Can you please tell me how can I change the disable element text color ? – Pratik Apr 29 '13 at 15:06
  • usually it automatically lightens the textcolor of disabled item. but if you want to override that behaviour, then simply override `getView` method within the same adapter and set a custom color to your disabled items – waqaslam Apr 29 '13 at 15:28
  • Well i override getView and able to change the background color but not able to change text color how can I achieve that ? – Pratik Apr 30 '13 at 05:23
  • [this](http://stackoverflow.com/questions/7361135/how-to-change-color-and-font-on-listview) should help you to understand how to change text color particularly – waqaslam Apr 30 '13 at 07:07