如何在android中添加自定义列表值以显示为芯片视图?

时间:2017-02-13 08:09:08

标签: android

public class ChipsView extends TokenCompleteTextView<ContactList> {

    public ChipsView(Context context){
        super(context);
    }
    public ChipsView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public ChipsView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    @Override
    protected View getViewForObject(ContactList list) {

        LayoutInflater inflater = (LayoutInflater.from(getContext()));
        View view = inflater.inflate(R.layout.chip,(ViewGroup)getParent(), false);
        TextView chip =(TextView)view.findViewById(R.id.chipsview);
        TextView label = (TextView)view.findViewById(R.id.label);

        chip.setText(list.getName());
        label.setText(list.getLabel());

    return view;
    }
}

在这里,我只能将列表中的值添加为芯片视图?如何添加新值以将其显示为芯片视图?

0 个答案:

没有答案