Hide scrollview indicator


#1

Is there any way to hide the scrollview indicator?


Hide Scroll View's scrollbars in both Ios & Android
#2

Sure it is:

Android (code)

someview.android.setVerticalScrollBarEnabled(false);

iOS (code)

someview.ios.showsVerticalScrollIndicator = false;

iOS (xml)

ios.showsVerticalScrollIndicator="false"

#3

Thank you but I can’t find that in api references :
here


#4

That’s because these are native platform APIs. NativeScript UI elements normally expose android/ios properties that allow you to access the underlying native View. Once you have it, you can manipulate it as you will using the Android/iOS api references.


#5

But wait, there’s more! Check out the SwissArmyKnife plugin which has built-in helpers for this https://github.com/TheOriginalJosh/nativescript-swiss-army-knife


#6

Why I lost .android part when back to page with routerExtension.back()?

Cannot read property ‘setHorizontalScrollBarEnabled’ of null


#7

Can you expand on your answer? This didn’t work for me.

const view = require("ui/core/view");
...
exports.onNavigatingTo = function(args) {
  var page = args.object;
  ...
  var silverNewCont = view.getViewById(page, "silverNew");
  silverNewCont.android.setHorizontalScrollBarEnabled(false);
}

XML

<ScrollView orientation="horizontal" id="silverNew">
...
</ScrollView>

The error is cannot read property ‘setHorizontalScrollBarEnabled’ of undefined.


#8

May be silverNewCont’s native view was not yet created by that time, try using the loaded event of ScrollView which guarantees the presence of native view.


#9

Man why do you give such vague answers? :pensive:

Is this what you’re talking about? I don’t get this, it doesn’t take any inputs, it doesn’t return any value, how does it work?

I tried

setTimeout(function(){
  	console.log(silverNewCont.onLoaded());
}, 3000);

and got undefined.


#10

I meant listening to the loaded event, not calling the onLoaded method itself.