cViewHolder.tv_number.setText(list.size() + "");
还有
tv.setText((index + 1) + ".");
c.tv_share_count.setText(record.readed_count + "/" + record.shared_count);
这种样子的应该如何转换?
怎么还问个类似的问题。。还是在string.xml中定义字符串,
<string name="count">%1$d/%2$d</string>
使用:setText(String.format(getString(R.string.count),record.readed_count,record.shared_count));
看了半天才看明白是怎么回事。。。
你把中文直接定义在strings.xml里面就可以,如果是还需要计算的.比如:
tv.setText((index + 1) + ".");
c.tv_share_count.setText(record.readed_count + "/" + record.shared_count);
就没必要放strings.xml里面了,你还要取出来处理,太麻烦了。
数字+“”自动转为字符串类型,1.可以先定义一个String变量,赋值后放到TextView中 2.在strings.xml中定义,然后取出