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}"

1
  • 100 is a number that replace %1$d in my_string Commented Jul 1, 2015 at 13:16

1 Answer 1

2

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

See this question

Sign up to request clarification or add additional context in comments.

1 Comment

Oh, I try to find my quetion on SO, but I did not find your link. I marked my question as dublicate. Thanks!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.