Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24700] Android: button has too much top padding, chops off bottom of title (regression)

GitHub Issuen/a
TypeBug
Priorityn/a
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsandroid, button, engSchedule, regression
ReporterShawn Lipscomb
AssigneeUnknown
Created2017-05-15T19:47:19.000+0000
Updated2019-07-30T16:33:43.000+0000

Description

When a button is 44dp tall, a 16dp title appears centered in the button, as it should. When a button is 33dp tall, 4 pixels of the same title are cropped at the bottom. The entire title seems shifted down in the button, as if it is not vertically centered. It appears that the internal label has been given a top, or the button has some top padding that it shouldn't have. This button appeared correctly in SDK 5.1.x. Sample code:
var win=Ti.UI.createWindow({backgroundColor: '#fff'});
var btn1=Ti.UI.createButton({ width:200,
                              {font:{fontSize:'16dp'},
                               title:'Refresh',
                               height:'44dp'
                               borderWidth:1,
                               borderRadius:5 });
var btn2=Ti.UI.createButton({ width:200,
                              {font:{fontSize:'16dp'},
                               title:'Refresh',
                               height:'33dp'
                               borderWidth:1,
                               borderRadius:5 });
win.add(btn1);
win.add(btn2);
win.open();

Comments

  1. Sharif AbuDarda 2017-05-16

    Hello, I can validate the issue, With the code below,
       var win = Ti.UI.createWindow({
           backgroundColor : '#fff'
       });
       
       var btn1 = Ti.UI.createButton({
           top: 20,
           width : 200,
       
           font : {
               fontSize : '16dp'
           },
       
           title : 'Refresh',
       
           height : '44dp',
       
           borderWidth : 1,
       
           borderRadius : 5
       });
       
       var btn2 = Ti.UI.createButton({
           top: 150,
           width : 200,
       
           font : {
               fontSize : '16dp'
           },
       
           title : 'Refresh',
       
           height : '33dp',
       
           borderWidth : 1,
       
           borderRadius : 5
       });
       
       win.add(btn1);
       
       win.add(btn2);
       
       win.open();
       
  2. Shawn Lipscomb 2018-12-17

    Can we get some traction on this issue? It's still a problem in Ti SDK 7.0.0. Also note that there seems to be some implicit left & right padding that was added at the same time, that we need to be able to either eliminate or reduce.
  3. Shawn Lipscomb 2019-07-30

    Also, similar to TIMOB-16512 and referenced in TIMOB-25594 and TIMOB-17258, we need to be able to control the internal padding (left, right, top, bottom) of each button independently from Titanium code (not styles).

JSON Source