我有這樣的視圖層次,垂直滾動型包含兩個孩子一個垂直的LinearLayout:Android的滾動型包含的LinearLayout用的WebView滾動行爲
ScrollView ->orientation:vertical, width:fill_parent, height: fill_parent
LinearLayout -> orientation:vertical, width:fill_parent, height: fill_parent
WebView -> width:fill_parent, height: fill_parent
GoogleAdView -> width:wrap_content, height:wrap_content
當滾動到網頁視圖的底部,點擊任何鏈接在那裏,雖然頁面加載,滾動條停留在底部而不是移動到頂部。我可以使用scroll.fullScroll(ScrollView.FOCUS_UP)
以編程方式設置滾動,但這會導致滾動條明顯跳起來。我試圖在頁面加載scrollView.setVerticalScrollBarEnabled(false)
之前隱藏滾動條,然後在頁面加載之後重新啓用它,然後調用scroll.fullScroll(ScrollView.FOCUS_UP)
,但仍然導致滾動條「跳躍」。
WebView本身可以在頁面更改上更好地處理滾動,看起來像隱藏滾動條,然後使其在加載後顯示在頁面頂部。有沒有辦法使用ScrollView來維護它?