How to use android native code in nativescript


I want to use Right-To-Left scroll view.
In android with java we wrote this two line code:

hor = (HorizontalScrollView) findViewById(;

How can I do it in nativescript? or better question is how can I access Focus_RIGHT in nativescript?


You should be able to access it by adding the package. Try console.log("focus right: " + android.widget.HorizontalScrollView.FOCUS_RIGHT)


Since HorizontalScrollView can be absolutely anything in JavaScript, you’d need to specify the full package name for the class whose public members, static or not, you are accessing.

To access a NativeScript view’s underlying android component you can look for the view’s android property.

let scrollview = topmost.getViewById("myScrollView");;

alternatively you can save the package in a variable, for Java-like access to classes:

let HorizontalScrollView = android.widget.HorizontalScrollView;