[TIMOB-15099] Android: borderRadius does not adhere to defaultunit
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2014-03-25T21:55:20.000+0000 |
Affected Version/s | Release 3.1.2 |
Fix Version/s | 2014 Sprint 06, 2014 Sprint 06 SDK, Release 3.2.3, Release 3.3.0 |
Components | Android |
Labels | module_views, parity, qe-testadded |
Reporter | Fokke Zandbergen |
Assignee | Sunila |
Created | 2013-09-05T09:23:21.000+0000 |
Updated | 2016-09-09T16:38:04.000+0000 |
Description
The Replace the code in
Now set the default unit to
borderRadius
property does not adhere to the default unit set in tiapp.xml
. Both borderWidth
and borderRadius
only accept Number
, so it's not possible to workaround by explicitly setting the unit. Like most other dimension-related properties (except fontSize
as far as I know) borderWidth
*does* use the default unit.
To reproduce
Create a new app
Replace the code in app.js
by:
var w = Ti.UI.createWindow({
backgroundColor: 'white',
modal: false
});
var v = Ti.UI.createView({
backgroundColor: 'red',
borderRadius: 150,
width: 300,
height: 300,
borderWidth: 100,
borderColor: 'black'
});
w.add(v);
w.open();
Run the app on both iOS and Android and the result will be like screenshots 1 and 2.
Now set the default unit to dp
by adding this to the tiapp.xml
:
<property name="ti.ui.defaultunit" type="string">dp</property>
Run the app on both platforms again and the result will be like screenshots 1 and 3. As you can see because of the DPI of the tested device the border radius is about half of what we expected.
Attachments
File | Date | Size |
---|---|---|
1-ios.jpg | 2013-09-05T09:23:21.000+0000 | 39970 |
2-android-px.png | 2013-09-05T09:23:21.000+0000 | 19508 |
3-android-dp.png | 2013-09-05T09:23:21.000+0000 | 19648 |
Please fix this issue
Use the default unit for radius. https://github.com/appcelerator/titanium_mobile/pull/5310
Please merge this fix.
New PR's master - https://github.com/appcelerator/titanium_mobile/pull/5521 3_2_X - https://github.com/appcelerator/titanium_mobile/pull/5524
borderRadius responds to the default unit defined in tiapp.xml as
Guys, this issue is not solved. Or if it was, then here it is crawling back in from the deads. I am using SDK 5.3.1 and it exists also on SDK 5.4. We have even tried to pass the value using something similar to the following ...
... but it has an erratic behaviour from one Android to another. The result is exactly similar to the screen capture provided by Fokke Zandbergen.
Wow, that is another bug here in the jira site. It destroyed a simple javascript line that was supposed to look like ... {color:#8eb021}borderRadius: isAndroid ? require('alloy/measurement').dpToPX(40) : 40{color}