stacJohn
stacJohn

Reputation: 11

Android icons within strings.xml

How I can change some icons which are declared in strings.xml

<resources>
   ...
    <string name="icon_info">&#xf129;</string>
    <string name="icon_heart">&#xf004;</string>
   ....

and after I use them in some source files in java

Button txt=(Button) findViewById(R.id.infotxt); 
Button txt1=(Button) findViewById(R.id.hearttxt); 

Typeface webfont = Typeface.createFromAsset(getAssets(), "fontawesome-webfont.ttf");
txt.setText(" " + getString(R.string.icon_info) + " ...");
txt.setTypeface(webfont);
txt1.setText(" " + getString(R.string.icon_heart) + " ...");
txt1.setTypeface(webfont);

I would like to change these icons to other icons I have on my computer.

Upvotes: 1

Views: 3063

Answers (1)

Majva
Majva

Reputation: 150

  <string name="icon_info">&#xf129;</string>
  <string name="icon_heart">&#xf004;</string>

they are fonts, not real images icon!!!! you can do : 1. convert your icons to font and use it as same as above, look at this article also this is usefull. 2. put your image file in drawable or assets and use it as a normal image file

Upvotes: 1

Related Questions