In html input we used to put restriction like this on the number of characters:

<input type="text" maxlength="10" size="10" />

But in nativescript you would need to code it in the code behind file like.

var phoneField = view.getViewById(page,'phoneField');
var fArray = [];
// 10 is the character length I want to restrict
fArray[0] = new android.text.InputFilter.LengthFilter(10);
phoneField.android.setFilters(fArray);

Put the above code in pageloaded or anywhere so that it executes.