PROBLEM DESCRIPTION
The customer wants to get the padding functionality provided natively by Android.
DOCS
http://developer.android.com/reference/android/view/View.html
To measure its dimensions, a view takes into account its padding. The padding is expressed in pixels for the left, top, right and bottom parts of the view. Padding can be used to offset the content of the view by a specific amount of pixels. For instance, a left padding of 2 will push the view's content by 2 pixels to the right of the left edge. Padding can be set using the setPadding(int, int, int, int) method and queried by calling getPaddingLeft(), getPaddingTop(), getPaddingRight(), getPaddingBottom().
Code
/* Example of padding in labels -
* Mauro Parra-Miranda mauropm@gmail.com
*/
var vLabel = Ti.UI.createView({
width: 300,
height: 35,
top: 120
});
var lLabel = Ti.UI.createLabel({
left: 20,
right: 20,
text: 'my text',
height: 30,
backgroundColor:'#fff'
});
vLabel.add(lLabel);
var win1 = Titanium.UI.createWindow({
title:'Padding',
backgroundColor:'#000'
});
win1.add(vLabel);
win1.open();
What about mapping something like: https://gist.github.com/2596057 to the views for iOS? This works great for UILabel but variants can be made for all kinds of views.
Check this PR https://github.com/appcelerator/titanium_mobile/pull/2645