image in buttons in Android

You must Login before you can answer or comment on any questions.

Hi, 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 ? Regards

— asked 2 years ago by Armindo Da Silva
2 Comments
  • 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 2 years ago by Paul Mietz Egli

  • Thanks for the link Paul.

    — commented 2 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?

Your Answer

Think you can help? Login to answer this question!