Saturday, February 23, 2019

Use icon from resource android

If we place an icon in folder drawable, when set for button, we use.
button.setBackgroundResource(R.drawable.ic_media_play);
But in resource android have many good design icons, we do not need to make ourself.
Add the word android to before like this.
button.setBackgroundResource(android.R.drawable.ic_media_play);
In file xml we use like this.

android:src="@android:drawable/ic_media_pause"
src can be background.

No comments:

Post a Comment