Skip to content
This repository was archived by the owner on Jan 12, 2025. It is now read-only.
Laurent Meyer edited this page Sep 6, 2015 · 1 revision

Customisation of Dropdown view

As many of you asked (even received some mails!), I rewrote most of the lib and here is how you can customize the view very easily.

It's quite simple to get an example because the library itself is based on this process: the base view is a custom view. You can basically copy the DemoAdapter and modify it with your own layout.

There are some restrictions though: it's not released yet because I need some testers (but it works properly on my different devices), so you have to clone the project and take the branch feature/properCustomAdapter to get started.

Then, subclass CustomViewAdapter

public class DemoAdapter extends CustomViewAdapter

After that, you have the data you need in the ArrayList<People> called displayed, so I would do something like that:

    @Override
    public int getCount() {
        return displayed == null ? 0 : displayed.size();
    }

    @Override
    public Object getItem(int position) {
        return displayed.get(position);
    }
     @Override
    public long getItemId(int position) {
        return yourAwesomeId;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        return yourAwesomeView
    }

Then, you have two choices: go in the AutoCompleteContactTextView itself and change line 145 with your newly created adapter (I'm sure it works); or you can call setCustomAdapter(Adapter) from your code but I didn't test that (I'm too lazy).

Clone this wiki locally