2

I have string resource like

<string name="my_string">Чек от %1$d до 2000 рублей</string>

and I use this string in the TextView and need to put default values on the view initialization . So, I know, what I can make it with context.getString(R.string.my_string, 100). But, I want to make it in the TextView xml definition.

Is there a way to use string formatting in TextView xml? Something like

android:text="@string/my_string{100}"

IliaEremin
  • 3,338
  • 3
  • 26
  • 35

1 Answers1

2

You can't put formatting arguments in XML, only in Java code.

See this question

Community
  • 1
  • 1
Max77
  • 1,466
  • 13
  • 19
  • Oh, I try to find my quetion on SO, but I did not find your link. I marked my question as dublicate. Thanks! – IliaEremin Jul 01 '15 at 13:16