我想创建新闻,比如活动,其中包含标题和日期以及顶部开头的一些共享和收藏按钮,文章文本(可能还有一些图片和标题标题)是我从服务器获取的html,以及最后列出相关新闻!
我必须使用WebView作为文章html,但由于我需要将标题和主webview一起滚动,我可能必须在包装ScrollView中使用它们,这显然不是最好的选择!
我有红色这些: webview in scrollview和 Disable scrolling in webview
但是我想知道到2015年实现这一目标的最佳方法是什么!可以使用android 4.01+
答案 0 :(得分:1)
嗯,事实证明,最好的方法是将它们放在scrollView中!
它适用于我的三星Android 4.4,但我不知道其余的!
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:id="@+id/news_activity_title_lay"
android:layout_width="match_parent"
android:layout_height="wrap_content">
//Some Widgets Here for header
</RelativeLayout>
<WebView
android:layout_below="@+id/news_activity_title_lay"
android:id="@+id/news_activity_web_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white">
</WebView>
<LinearLayout
android:id="@+id/news_activity_related_base_lay"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_below="@+id/news_activity_web_view">
//Some Widgets Here foe footer
</LinearLayout>
</RelativeLayout>
有趣的是,Android Studio虽然说我不应该这样做! :/