I load html content for example webView.loadData(mAdvertisement, "text/html; charset=utf-8", null), I have ScrollView which contain ImageView, TextureView and WebView, I have problem when I scroll then it's too lagging it's not smoothly working, I also tried this
webView.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
if (Build.VERSION.SDK_INT >= 19) {
// chromium, enable hardware acceleration
webView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
} else {
// older android version, disable hardware acceleration
webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
but still it's as it is!!! Even I put into manifest android:hardwareAccelerated="true"
but it's same so how can I solve it?
My xml is below
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:customFont="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF"
android:descendantFocusability="beforeDescendants"
android:focusableInTouchMode="true">
<View
android:id="@+id/view"
android:layout_width="match_parent"
android:layout_height="@dimen/divider_height"
android:background="@color/gray_divider"
android:visibility="gone"/>
<ScrollView
android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_below="@+id/view"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/imgAdvertisement"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"/>
<TextureView
android:id="@+id/videoTextUreView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white">
<WebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:overScrollMode="never"
android:padding="@dimen/padding_10"
android:scrollbars="none" />
<CustomTextView
android:id="@+id/txtNoDataFound"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center"
android:padding="@dimen/padding_10"
android:text="@string/no_data_found"
android:textColor="@android:color/holo_red_light"
android:textSize="@dimen/text_size_xlarge"
android:visibility="gone"
customFont:fontTextStyle="2" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>