Friday 15 August 2014

Android how to adjust image background to be centered -


I have ToggleButton set to property in android: background The image is with. This background image fits all the backgrounds.

I would like to focus on the image of a small background inside a big toggle, which will save the image from expanding to fit all backgrounds.

Does anyone clue?

If you want to keep the text on top of an image, then you might find the image in the code instead of XML To set something like this:

  Resource R = Miller Resource (); Dry myimage = r.getDrawable (R.drawable.myimage); Button mybutton = findViewById (R.id.mibutton); Myimage.setBounds (0, 0, myimage.getIntrinsicWidth), myimage.getIntrinsicHeight ()); Mybutton.setCompoundDrawables (MyImage, Blank, Blank, Blank);    

No comments:

Post a Comment