Я хочу использовать WebView в RecyclerView (пробовал и тоже не удалось) или CollapsingToolbarLayout, но компонент html не может прокручиваться, это веб-просмотр в CollapsingToolbarLayout, всплывающее окно часового пояса не может прокручиваться.
активность xml:
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data></data>
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:id="@+id/appbar"
android:layout_height="wrap_content">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:id="@+id/collapsing"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<include
android:id="@+id/topview"
layout="@layout/itemview_crypto_kline"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.7" />
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin" />
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</layout>
itemview_crypto_kline.xml:
<?xml version="1.0" encoding="utf-8"?>
<layout>
<data>
<variable
name="ticker"
type="androidx.lifecycle.MutableLiveData<data.bean.Ticker>" />
</data>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/bottomColor"
android:orientation="vertical">
<TextView
android:id="@+id/tv_close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/border_margin"
android:layout_marginTop="@dimen/small_margin"
android:text='@{ticker.close+""}'
android:textColor="@color/decreasingColor"
android:textSize="@dimen/ic_text_size" />
<TextView
android:id="@+id/tv_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/border_margin"
android:layout_marginBottom="@dimen/small_margin"
android:text='@{ticker.time}'
android:textColor="@color/tip_color"
android:textSize="@dimen/very_small_text_size" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/border_margin"
android:layout_marginTop="@dimen/small_margin"
android:layout_marginBottom="@dimen/small_margin">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/open"
android:textColor="@color/tip_color"
android:textSize="@dimen/very_small_text_size" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/small_margin"
android:layout_marginEnd="@dimen/small_margin"
android:layout_weight="2"
android:text='@{ticker.open+""}'
android:textColor="@color/textColor"
android:textSize="@dimen/very_small_text_size" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/border_margin"
android:layout_weight="1"
android:text="@string/vol"
android:textColor="@color/tip_color"
android:textSize="@dimen/very_small_text_size" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/small_margin"
android:layout_marginEnd="@dimen/small_margin"
android:layout_weight="2"
android:text='@{ticker.vol+""}'
android:textColor="@color/textColor"
android:textSize="@dimen/very_small_text_size" />
<View
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="4" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/border_margin"
android:layout_marginBottom="@dimen/small_margin">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/high"
android:textColor="@color/tip_color"
android:textSize="@dimen/very_small_text_size" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/small_margin"
android:layout_marginEnd="@dimen/small_margin"
android:layout_weight="2"
android:text='@{ticker.high+""}'
android:textColor="@color/textColor"
android:textSize="@dimen/very_small_text_size" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/border_margin"
android:layout_weight="1"
android:text="@string/low"
android:textColor="@color/tip_color"
android:textSize="@dimen/very_small_text_size" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/small_margin"
android:layout_marginEnd="@dimen/small_margin"
android:layout_weight="2"
android:text='@{ticker.low+""}'
android:textColor="@color/textColor"
android:textSize="@dimen/very_small_text_size" />
<View
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_weight="4" />
</LinearLayout>
</LinearLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="300dp"
android:layout_marginTop="@dimen/small_margin"
android:background="@color/colorPrimary">
<WebView
android:id="@+id/webview"
android:nestedScrollingEnabled="true"
android:layout_width="match_parent"
android:layout_height="300dp" />
<View
android:id="@+id/cover"
android:layout_width="match_parent"
android:layout_height="300dp"
android:background="@color/colorPrimary" />
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/small_margin"
android:orientation="horizontal">
<View
android:layout_width="0dp"
android:layout_height="10dp"
android:layout_gravity="center_vertical"
android:layout_weight="1" />
<ImageView
android:id="@+id/iv_refresh"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginStart="@dimen/border_margin"
android:layout_marginTop="@dimen/small_margin"
android:layout_marginBottom="@dimen/small_margin"
android:src="@drawable/ic_refresh" />
<ImageView
android:id="@+id/iv_translate"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginStart="@dimen/border_margin"
android:layout_marginTop="@dimen/small_margin"
android:layout_marginBottom="@dimen/small_margin"
android:src="@drawable/ic_translate" />
<ImageView
android:id="@+id/iv_fullscreen"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginStart="@dimen/border_margin"
android:layout_marginTop="@dimen/small_margin"
android:layout_marginEnd="@dimen/border_margin"
android:layout_marginBottom="@dimen/small_margin"
android:src="@drawable/ic_fullscreen" />
</LinearLayout>
</LinearLayout>
</layout>
просмотр предметов ранее использовался RecyclerView, так что, возможно, стиль выглядит ужасно.
Я думаю, что RecyclerView или CoordinatorLayout стоили событие, но когда я попробовал приведенный ниже код, он также не может прокручиваться.
AppBarLayout.LayoutParams layoutParams = (AppBarLayout.LayoutParams) binding.collapsing.getLayoutParams();
layoutParams.setScrollFlags(0);
binding.collapsing.setLayoutParams(layoutParams);
html веб-просмотра ниже:
<body style="margin:0;padding:0;background-color:#2c2d3b">
<div class="tradingview-widget-container">
<div id="tradingview_49c3f"></div>
<script type="text/javascript" src="https://s3.tradingview.com/tv.js"></script>
<script type="text/javascript">
new TradingView.widget({"autosize": true,"symbol": "COINBASE:BTCUSD","interval": "1","timezone": "America/New_York","theme": "Dark","style": "3","locale": "en","toolbar_bg": "#f1f3f6","enable_publishing": false,"hide_top_toolbar": true,"hide_legend": true,"withdateranges": true,"save_image": false,"container_id": "tradingview_49c3f"});
</script>
</div>
</body>
так как сделать так, чтобы часовой пояс веб-просмотра мог прокручиваться?