LoginSignup
0
0

More than 5 years have passed since last update.

Stringリソースで%を文字として表示する

Posted at

文字列の一部をプログラムから扱うなどするとき

string.xml
<string name="string_samples">取得中……%1$d </string>

動的に文字をいれたあとに「%」をいれることで少し詰まった。

NG 落ちる。

string.xml
<string name="string_samples">取得中……%1$d% </string>

NG 落ちないが表示されない

string.xml
<string name="string_samples">取得中……%1$d\% </string>

OK

string.xml
<string name="string_samples">取得中……%1$d %% </string>

[参考]http://qiita.com/le_skamba/items/3c7c05d8d137185f753f
ありがとうございます

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0