format statement in a string resource file

后端 未结 5 950
栀梦
栀梦 2020-11-29 17:28

I have strings defined in the usual strings.xml Resource file like this:

 HELLO

Is it pos

5条回答
  •  误落风尘
    2020-11-29 17:40

    You should add formatted="false" to your string resource


    Here is an example

    In your strings.xml :

    Amount: %.2f%n  for %d days
    

    In your code:

    yourTextView.setText(String.format(getString(R.string.all), 3.12, 2));
    

提交回复
热议问题