1

We use getString(R.string.test,1) where 1 is argument in

<string name=test>Hello %1$d</string>

This works in java, but i want to use the same in android:text for textviews in layout.xml. But when I use: @string/test it displays Hello %1$d or @string/test,0 then gives error( not the expected string). Is there a way to provide argument for string in layout.xml?

pebble
  • 331
  • 2
  • 13

1 Answers1

0

Set it programmatically like below.

mTextView.setText(String.format(getString(R.string.test), 1));
Mehul Kabaria
  • 6,404
  • 4
  • 25
  • 50