如何添加自定义字体系列。
因此,当我使用没有ViewHolder的listView时,列表中的项目在滚动时会更改其顺序(我不知道为什么)。但是当我使用ViewHolder时,订单保持正常
public static class ViewHolder {
TextView text;
}
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder viewHolder;
if (convertView == null) {
viewHolder = new ViewHolder();
LayoutInflater inflater = LayoutInflater.from(getContext());
convertView = inflater.inflate(R.layout.armor_element_custom, parent, false);
viewHolder.text = convertView.findViewById(R.id.text);
result = convertView;
convertView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
result = convertView;
}
viewHolder.text.setText(dataModel.getText());
return convertView;
}