View
 

Hide the scrollbar in Android

Page history last edited by Alex Cheuk 1 month, 4 weeks ago Saved with comment

In Eclipse open DroidGap.java. Find the function public void onCreate(Bundle savedInstanceState). Look for the line that created the Android WebView:

 

appView = (WebView) findViewById(R.id.appView);

 

Beneath that, add these two lines:

 

appView.setVerticalScrollBarEnabled(false);
appView.setHorizontalScrollBarEnabled(false);

 

The scroll bars will no longer appear.

 

 

Since Phonegap v0.9.2 there is no need to change core DroidGap.java files.

Just change you main activity class ( the one that extends DroidGap):

 

public class MyApp extends DroidGap {

 

     @Override

     public void onCreate(Bundle savedInstanceState) {

          super.onCreate(savedInstanceState); 

          super.init();

 

          super.loadUrl("file:///android_asset/www/index.html");

          

          // Disable scrollbars 

          super.appView.setVerticalScrollBarEnabled(false);

          super.appView.setHorizontalScrollBarEnabled(false);

 

          // Scrollbar Overlay Content

           super.appView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);

 

     }

}