How to set performance scroll for webview?

I load a url like mail.google.com into a webview in my application and scroll through the webpage so slowly! Tested on Samsung GalaxyTab 10.1, Motorola Droid X, Acer Liquid, etc. Why?

The parameters I'm trying to use are: webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE); webView.setRenderPriority(RenderPriority.HIGH); webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE); webView.setRenderPriority(RenderPriority.HIGH); webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE); webView.setRenderPriority(RenderPriority.HIGH);

+7
source share
2 answers

add android: hardwareAccelerated = "true" to the tag in your manifest.

+2
source

This is the main.xml file

This code is just a scroll, any where you can use

  <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:fillViewport="true"> <LinearLayout android:id="@+id/LinearLayout01" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView android:id="@+id/TextView01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="This is a header" android:textAppearance="?android:attr/textAppearanceLarge" android:paddingLeft="8dip" android:paddingRight="8dip" android:paddingTop="8dip"></TextView> <TextView android:text="@+id/TextView02" android:id="@+id/TextView02" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_weight="1.0"></TextView> <LinearLayout android:id="@+id/LinearLayout02" android:layout_width="wrap_content" android:layout_height="wrap_content"> <Button android:id="@+id/Button01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Submit" android:layout_weight="1.0"></Button> <Button android:id="@+id/Button02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Cancel" android:layout_weight="1.0"></Button> </LinearLayout> </LinearLayout> </ScrollView> 

This is a .java file

 import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.TextView; public class ScrollViewActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); TextView view = (TextView) findViewById(R.id.TextView02); String s=""; for (int i=0; i < 200; i++) { s += "Android Market "; } view.setText(s); } } 
-2
source

Source: https://habr.com/ru/post/899605/


All Articles