question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hide scroll bar in android app

See original GitHub issue

Discussed in https://github.com/ionic-team/capacitor/discussions/5416

<div type='discussions-op-text'>

Originally posted by mohammad0-0ahmad February 8, 2022 Hello!

I’ve tried to hide the scroll bar in Android app that is created by using capacitor and next.js and I couldn’t do so in web source code. I ended up to modify @capacitor\android\capacitor\src\main\java\com\getcapacitor\CapacitorWebView.java file by adding the following line inside constructure function:

    public CapacitorWebView(Context context, AttributeSet attrs) {
        super(context, attrs);
   +     setVerticalScrollBarEnabled(false);
    }

That line could hide the scrollbar but I wonder if I can hide it from my source code instead because I couldn’t find a solution for that in the docs.

Best regardes.

Screenshot_1644343438

</div>

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
jcesarmobilecommented, May 18, 2022

You can create a plugin and put this code in the load method

public void load() {
    bridge.getWebView().setVerticalScrollBarEnabled(false);
}

Or without a plugin you can put this code in the MainActivity.java

    @Override
    public void onStart() {
        super.onStart();
        bridge.getWebView().setVerticalScrollBarEnabled(false);
    }
1reaction
ThinhVucommented, Mar 12, 2022

/* Hide scrollbar for IE, Edge and Firefox / .hide-scroll-bar { -ms-overflow-style: none; / IE and Edge / scrollbar-width: none; / Firefox / } / Hide scrollbar for Chrome, Safari and Opera */ .hide-scroll-bar::-webkit-scrollbar { display: none; }

Thanks for your answer, but does this work with MUI? With other words, I am not using ionic-ui “components” solution

It’s CSS and it should work on any device, unless the CapacitorJS team does something weird with their custom web browser.

I’m not sure about that. But I think you should try it.

Note that the code above create hide-scroll-bar class and you need to add this class to the element you want the scroll bars to be hidden. If you want to hide scroll bars for entire app, using * selector instead.

Read more comments on GitHub >

github_iconTop Results From Across the Web

android - Hide scrollbar in ScrollView - Stack Overflow
The above lines of codes will work if you want to hide the scrollbar without disabling it. And for disabling a scrollbar, write...
Read more >
Hide Scrollbar from Android Views - Code2care
Hide Scrollbar from Android Views ... If you have scroll element on your Android Intent like HorizontalScrollView, TextView or elements inside ...
Read more >
how to remove scrollbar on webview android - YouTube
how to hide scrollbar in webview android, how to remove scrollbar on webview android,webview scrollbar hide,webview scrollbar remove, hide ...
Read more >
Hide Scrollbar In ScrollView And RecyclerView | Android Java
saweria : https://saweria.co/aldybelajar======ORIGINAL SONG======Departure by Ghostrifter Official ...
Read more >
ScrollView - Android Developers
Position the scroll bar at the default position as determined by the system. ... Hide the system bars instead if the application needs...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found