本文整理汇总了Java中com.zhy.base.adapter.abslistview.CommonAdapter类的典型用法代码示例。如果您正苦于以下问题:Java CommonAdapter类的具体用法?Java CommonAdapter怎么用?Java CommonAdapter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CommonAdapter类属于com.zhy.base.adapter.abslistview包,在下文中一共展示了CommonAdapter类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onViewCreated
import com.zhy.base.adapter.abslistview.CommonAdapter; //导入依赖的package包/类
@Override
public void onViewCreated(final View view, @Nullable Bundle savedInstanceState)
{
initDatas();
mListView = (ListView) view.findViewById(R.id.id_listview);
mListView.setAdapter(new CommonAdapter<List<String>>(getActivity(), R.layout.item_for_listview, mDatas)
{
Map<Integer, Set<Integer>> selectedMap = new HashMap<Integer, Set<Integer>>();
@Override
public void convert(final ViewHolder viewHolder, List<String> strings)
{
TagFlowLayout tagFlowLayout = viewHolder.getView(R.id.id_tagflowlayout);
TagAdapter<String> tagAdapter = new TagAdapter<String>(strings)
{
@Override
public View getView(FlowLayout parent, int position, String o)
{
//can use viewholder
TextView tv = (TextView) mInflater.inflate(R.layout.tv,
parent, false);
tv.setText(o);
return tv;
}
};
tagFlowLayout.setAdapter(tagAdapter);
//重置状态
tagAdapter.setSelectedList(selectedMap.get(viewHolder.getItemPosition()));
tagFlowLayout.setOnSelectListener(new TagFlowLayout.OnSelectListener()
{
@Override
public void onSelected(Set<Integer> selectPosSet)
{
selectedMap.put(viewHolder.getItemPosition(), selectPosSet);
}
});
}
});
}