요즘 웹앱 종종 작업하게 되는데요.
즉, 앱 안에 웹뷰로 모바일 웹을 띄우는 작업을 진행시 간혹 스크롤 때문에 웹표준과 충돌나서 흰여백이 생기는 경우가 있습니다.
한동안 스타일 문제로 알고 자료 계속 찾다가 알고 보니 웹뷰에서 스크롤만 false 처리하면 끝이더군요.
그렇다고 스크롤이 기능이 안되는건 아니구요 스크롤만 숨겨서 웹에서 폭이 모두 나오게끔 하는 겁니다.
Hide the scrollbar in Android
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();
// Disable scrollbars
super.appView.setVerticalScrollBarEnabled(false);
super.appView.setHorizontalScrollBarEnabled(false);
super.loadUrl("file:///android_asset/www/index.html");
}
}
2012/01/02 02:14 2012/01/02 02:14

Trackback Address :: https://youngsam.net/trackback/1728