Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-7989] Android: Specifying Units Breaks Views

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2012-04-04T14:51:46.000+0000
Affected Version/sn/a
Fix Version/sRelease 2.0.0, Sprint 2012-06
ComponentsAndroid
Labelsmodule_view, qe-testadded, regression
ReporterDawson Toth
AssigneeAllen Yeung
Created2012-03-14T10:15:29.000+0000
Updated2012-04-04T14:51:46.000+0000

Description

Problem

Specifying the units on a dimension causes a view to not display.

Regression Point

This wasn't broken in 1.8.2, but master builds exhibit this bug.

Reproduction

var win = Ti.UI.createWindow({
    backgroundColor: '#fff'
});

win.add(Ti.UI.createLabel({
    text: 'Labels with dp or dip do not show up!',
    color: '#fff',
    height: '30dp',
    backgroundColor: 'red'
}));

win.add(Ti.UI.createLabel({
    text: 'This one will show up.',
    color: '#fff',
    height: 30,
    backgroundColor: 'blue'
}));

win.add(Ti.UI.createLabel({
    text: 'And this one will not show up either.',
    color: '#fff',
    height: '30dip',
    backgroundColor: 'green'
}));

win.add(Ti.UI.createView({
    width: '30dp', height: '30dp',
    backgroundColor: 'purple',
    top: '0dp', left: '0dp'
}));

win.add(Ti.UI.createView({
    width: '30dip', height: '30dip',
    backgroundColor: 'orange',
    top: '0dip', right: '0dip'
}));

win.add(Ti.UI.createView({
    width: 30, height: 30,
    backgroundColor: 'pink',
    bottom: 0, left: 0
}));

win.open();

Tested On

Testing with 2.0.0

version=2.0.0 module_apiversion=2 timestamp=03/14/12 09:03 githash=a70a010 BROKEN on Samsung EPIC 4G (Android 2.3.7) BROKEN on Galaxy TAB 7.0 Plus (Android 3.2)
03-14 13:13:56.945: I/ActivityManager(227): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.dawson.play2012/.PlayActivity bnds=[365,58][475,176] } from pid 323
03-14 13:13:57.027: I/TiRootActivity(4574): (main) [0,0] checkpoint, on root activity create, savedInstanceState: null
03-14 13:13:57.480: W/TiApplication(4574): (KrollRuntimeThread) [451,451] Registering module with name already in use.
03-14 13:13:57.480: E/TiApplication(4574): (KrollRuntimeThread) [0,451] APP PROXY: ti.modules.titanium.app.AppModule@405bb108
03-14 13:13:57.628: I/TiRootActivity(4574): (main) [0,0] checkpoint, on root activity resume. activity = com.dawson.play2012.PlayActivity@4059ce00
03-14 13:13:57.703: I/ActivityManager(227): Displayed com.dawson.play2012/.PlayActivity: +677ms

Testing with 1.8.2

WORKS on Samsung EPIC 4G (Android 2.3.7) WORKS on Galaxy TAB 7.0 Plus (Android 3.2)

Comments

  1. Natalie Huynh 2012-03-19

    Tested with 2.0.0.v20120319003254 with v8/rhino on LG Slate 3.1 and Emulator 2.3.3
  2. Michael Pettiford 2012-04-04

    Reopening/closing to add/remove labels

JSON Source