NestedScrollView和的WebView身高问题 [英] NestedScrollView and WebView height issue
问题描述
我用新的 android.support.v4.widget.NestedScrollView
和我面临的问题。
I use new android.support.v4.widget.NestedScrollView
and I faced with issue.
下面是我的布局:
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="250dp">
<android.support.design.widget.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.7">
<!-- some views inside -->
</RelativeLayout>
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:layout_collapseMode="pin"
/>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
>
<WebView
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</android.support.v4.widget.NestedScrollView>
我需要加载HTML里面TextView的,所以我做:
I need to load html inside textView, so I make:
content.setText(Html.fromHtml(htmlString));
content.setText(Html.fromHtml(htmlString));
和它看起来很奇怪。我的TextView放置在屏幕的底部。
And it looks strange. My textview placed at the bottom of screen.
在我刷上的文字,它开始看起来正常。
After I swipe on the text it starts to look normal.
和我想的TextView不仅查看这些问题。
我试着使用web视图,但它甚至不显示内容(我认为由于不正确的高度计算)。
所以,我需要的WebView或TextView的纠正工作, NestedScrollView
。
And I think textview is not only view with these issue.
I tried use webview, but it even does not show content (I think due to incorrect height computation).
So I need webview or textview to correct work with NestedScrollView
.
P.S。如果我设置 DP
TextView的高度,然后文本看起来正确的,但我需要 WRAP_CONTENT
的高度。
P.S. If I set textview height in dp
then text looks correctly, but I need wrap_content
for height.
最后,我需要使用的WebView
。亚历克斯Facciorusso答案部分工作,但我面对的另一个问题。当的WebView
的内容有一些特定的高度,然后我可以看到的内容的一部分,但我无法向下滚动。
例:
Finally I need to use WebView
. Alex Facciorusso answer partly works, but I faced with another issue. When WebView
content has some specific height then I can see part of the content, but I can't scroll down.
Example:
推荐答案
由于MAYUR Raiyani说:code.google.com / P /安卓/问题/详细信息:这个问题在支持库版本22.2.1解决?ID = 175234。感谢所有的答案。
As Mayur Raiyani said: this issue is resolved in support library version 22.2.1: code.google.com/p/android/issues/detail?id=175234. Thanks all for answers.
这篇关于NestedScrollView和的WebView身高问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!