- 把屏幕上的一個片段,包含:
- 一個的WebView
- ...完全展開高度
- 嵌入一個固定大小的佈局
- 滾動佈局(即整個東西,包括全高的webview)
這似乎是不可能的。我現在已經閱讀了10多個關於SO的不同問題/答案,它們都涵蓋了Android WebView中的不同關鍵錯誤,但沒有一個涉及這種情況。
看來(從閱讀其他問題,並按照對Android網站鏈接到當前未修正的錯誤)說:
- 的WebView高度一直是錯的(非固定Android的2 - 4:如高度從未減少)
- WebView的滾動中斷,不間斷,在連續的Android版本中以新的方式重新打破(例如:某些版本的ScrollView需要控制,其他WebView需要控制,其他版本的WebView需要控制,其他版本會「戰鬥」並且會出現口吃等)
- 你必須使用ScrollView的一些奇怪的調整,使它做它應該做的t - out-t他盒。例如「android:fillViewport =」true「(呵呵?是不是應該做什麼」layout_height = fill_parent「)
有沒有人有工作代碼來實現這個相對簡單和通用的設置? d對任何有用的東西都很感興趣(除了當然「扔掉你的Android應用程序並寫一個web應用程序」。這可能會起作用,但不切實際,可悲)
僅供參考(以及任何其他嘗試類似的東西的人)這是我的佈局,填滿屏幕,但所有滾動被禁用,沒有理由,我可以看到:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true"
>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<!-- page header -->
<RelativeLayout
android:id="@+id/fragment_detailspage_titletext_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:visibility="visible" >
<include
android:id="@+id/fragment_detailspage_titletext_include"
layout="@layout/include_textheader"
android:visibility="visible" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/fragment_detailspage_header_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/fragment_detailspage_titletext_layout"
android:clickable="true"
android:visibility="visible" >
<!-- logo image -->
<include
android:id="@+id/fragment_detailspage_logoimageheader_include"
layout="@layout/include_logoimageheader" />
</RelativeLayout>
<!-- page footer -->
<RelativeLayout
android:id="@+id/fragment_detailspage_footer_layout"
android:layout_width="fill_parent"
android:layout_height="64dp"
android:layout_alignParentBottom="true"
android:background="@drawable/generic_button_not_pressed"
android:clickable="true"
android:visibility="visible" >
<!-- 1 buttons -->
<include
android:id="@+id/fragment_detailspage_bottombuttonstrip1_include"
android:layout_width="wrap_content"
android:layout_height="64dp"
android:layout_centerHorizontal="true"
layout="@layout/include_bottombuttonstrip1" />
</RelativeLayout>
<!-- page content -->
<WebView
android:id="@+id/fragment_detailspage_content_web"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="@id/fragment_detailspage_footer_layout"
android:layout_below="@id/fragment_detailspage_header_layout"
android:visibility="visible" />
</RelativeLayout>
</ScrollView>
你看過這篇文章嗎? http://stackoverflow.com/a/13353874/801437 – 2013-05-08 20:23:49
「我現在已經閱讀了超過10個不同的關於SO的問題/答案,它們都涵蓋了Android WebView中的不同關鍵錯誤,但沒有一個覆蓋這種情況」我很確定我已經回答了很多Android問題,表示將可滾動內容放入ScrollView中很少有效。 – CommonsWare 2013-05-08 20:26:28
對CommonsWare的觀點來說,不要在ScrollView中放置可滾動的視圖。你的佈局看起來可能有些過度設計。你可以附加一個圖像到你想要你的佈局看起來像什麼樣的問題然後,也許我們可以幫助你簡化你的XML並解釋爲什麼你不需要在ScrollView中的WebView – Blundell 2013-05-08 20:46:59