I have this simple layout XML, and a green_square.png file which is 30X30 pixels
There lots of great answers here which actually works. I just what to share the way I do this now with a more modern XML syntax, the constraint view. Trust me constraint view rooks!
of course the tools:context="com.collectsavings.collect.collectpro.LoginAndRegisterPrompt" and android:src="@drawable/green_square" Should all match your app activity context and drawabl resources respectively.