Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9107] Android: Label is not centering vertically inside a button

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionDuplicate
Resolution Date2012-05-16T17:25:02.000+0000
Affected Version/sRelease 2.0.1
Fix Version/sn/a
ComponentsAndroid
Labelscore
ReporterShannon Hicks
AssigneeNeeraj Gupta
Created2012-05-03T11:18:21.000+0000
Updated2017-03-22T22:11:27.000+0000

Description

I can't quite pinpoint the problem, but the label is not centering vertically inside a button when you add a background image. This was not a problem in Ti 2.0. Here's some sample code: in tiapp.xml:
    <android xmlns:android="http://schemas.android.com/apk/res/android">
        <manifest android:installLocation="auto">
            <uses-sdk android:minSdkVersion="7"/>
            <supports-screens android:anyDensity="false"
                android:largeScreens="false"
                android:normalScreens="true" android:smallScreens="false"/>
        </manifest>
    </android>
app.js:
var win = Ti.UI.createWindow();

var buttonTest = Ti.UI.createButton({
	height:28,
	width:200,
	title:'Button 1',
	top:20,
	font:{fontSize:12,fontWeight:'bold'},
	backgroundImage:'/assets/button_background.png',
});

win.add(buttonTest);

win.open();
I've attached the background image. When run on Android, it appears that the baseline of the text is at the button's vertical center. When run on iOS, it displays correctly.

Attachments

FileDateSize
button_background.png2012-05-03T11:18:21.000+00002048

Comments

  1. Shannon Hicks 2012-05-16

    Looks like this is probably a dupe of TIMOB-9055
  2. Arthur Evans 2012-05-16

    Resolving as dup. Looks like TIMOB-9055 was fixed in master on 5/11, so any CI build after that ought to include the fix if you want to test it against your app.
  3. Shannon Hicks 2012-05-17

    I can confirm that TIMOB-9055 resolved my issue
  4. Lee Morris 2017-03-22

    Closing ticket as duplicate and links to the related ticket have been provided above.

JSON Source