image in buttons in Android

in IOS my buttons has an image (glyph) on the left side of the text.
I just use something like :

var computeBtn = Titanium.UI.createButton({
    title : "Compute",
    image : '../images/compute.png',
    bottom : "4dp",
    width :"200dp",
    height : "40dp",
    font : {
        fontSize : "12dp"

    color : '#3D3D3D',
    enabled : false

the problem is that on Android it tends to stretch the image to the whole button area.
How to avoid this ?

— asked 4 years ago by Armindo Da Silva
  • This is a known bug in the SDK: TIMOB-5985. A workaround might be to create a full background image for your button containing the glyph in the proper place. This would work if your button title never changes.

    — commented 4 years ago by Paul Mietz Egli
  • Thanks for the link Paul.

    — commented 4 years ago by Armindo Da Silva

1 Answer

  • It might be because you are using 'dp' values - Have you tried it with plain integers to see if it then happens too?