Android 앱용 웹뷰를 구축 중입니다.
데스크톱 브라우저의 overflow-y: scroll
경우 <body>
태그를 추가 하여 페이지에 스크롤바 트랙을 강제 할 수 있지만 이것이 실제 스크롤바를 강제하는 것은 아닙니다.
앱에서 "강제 스크롤바"를 요청 받았지만 실제 스크롤바가 아닌 트랙을 제자리에 배치하면됩니다.
webview가로드 된 Android 버전에 관계없이 스크롤바를 강제로 표시하는 방법이 있습니까?
Android 측과 HTML + CSS 측의 옵션은 무엇입니까?
현재 가장 좋은 방법은 Java 코드 android:fadeScrollbars="false"
와 동일한 xml 에서 사용 하는 것입니다 ScrollView.setScrollbarFadingEnabled(false);
.
또는
android:scrollbarFadeDuration="0"
의지를 설정하면 트릭이됩니다.
예 : onCreate () 메소드에서 : 이것을 시도하십시오 :
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.your_web_view_layout);
browser = (WebView)findViewById(R.id.your_webview);
WebSettings mWebSettings = browser.getSettings();
mWebSettings.setBuiltInZoomControls(true);
browser.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
browser.setScrollbarFadingEnabled(false);
browser.loadUrl("file:///android_asset/index.html");
}
또는
사용해보십시오 WebView
돌며 ScrollView
및 사용 android:fadeScrollbars="false"
에 대한ScrollView
예 :
<ScrollView android:layout_width="fill_parent"
android:layout_height="86px"
android:id="@+id/scrollTxtDescription"
android:fadeScrollbars="false"
android:layout_below="@id/txtLieuPromo1"
android:layout_alignLeft="@id/txtLieuPromo1">
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/layoutTxtDescription"
>
<WebView android:id="@+id/txtDescription"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
</ScrollView>
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다