Android 字符串中包含动态获取的数据

来源:互联网 发布:ubuntu chmod 777 编辑:程序博客网 时间:2024/06/16 18:25
1.string.xml中如下配置
<string name="electric_counters">包含了%1$d个家电设备</string>
2.adapter类中如下:
int counts = getElectricCount(mRooms.get(position).getName()).size();String counterFormat = convertView.getResources().getString(R.string.electric_counters);String electricCounters = String.format(counterFormat,counts);viewHolder.mCountText.setText(electricCounters);
阅读全文
0 0