获取strings.xml中的变量(可配置为通配符)
1.在AndroidManifest.xml与layout等xml文件里:
android:text="@string/resource_name"
2.在activity里:
方法一:this.getString(R.string.resource_name);
方法二:getResources().getString(R.string.resource_name);
3.在其他java文件(必须有Context或Application)
方法一:context.getString(R.string.resource_name);
方法二: application.getString(R.string.resource_name);
minFaceTv.setText(mContext.getString(R.string.min_face_size, "60"));
<string name="min_face_size">最小检测人脸:%s px</string>
浙公网安备 33010602011771号