android - NestedScrollView and WebView height issue -
i use new android.support.v4.widget.nestedscrollview
, faced issue.
here layout:
<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"> <!-- 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>
i need load html inside textview, make:
content.settext(html.fromhtml(htmlstring));
and looks strange. textview placed @ bottom of screen.
after swipe on text starts normal.
and think textview not view these issue. tried use webview, not show content (i think due incorrect height computation). need webview or textview correct work nestedscrollview
.
p.s. if set textview height in dp
text looks correctly, need wrap_content
height.
updated 08.07.15
finally need use webview
. alex facciorusso answer partly works, faced issue. when webview
content has specific height can see part of content, can't scroll down. example:
a simple workaround add empty view 500dp height below textview inside of linearlayout. view shall push textview right position.
<android.support.v4.widget.nestedscrollview app:layout_behavior="@string/appbar_scrolling_view_behavior" android:layout_width="match_parent" android:layout_height="match_parent"> <!-- scrolling content --> <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <textview android:layout_width="match_parent" android:layout_height="match_parent" android:text="@string/random_text" /> <view android:layout_width="match_parent" android:layout_height="500dp"/> </linearlayout>
Comments
Post a Comment