我正在制作一个简单的Webview应用程序。当我单击“查找”按钮并调用findNext(true)时,Webview不会滚动到突出显示的文本。
它在没有nestedscrollview的情况下运行良好。 该怎么办?
如何获取webview突出显示文本的位置,我想我可以使用nestedscrollview滚动到该位置
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
><LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
><EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/edittext"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="find"
android:text="find"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="next"
android:text="next"
/>
</LinearLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<WebView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/webview"
/>
</android.support.v4.widget.NestedScrollView>
public void find(View view)
{
String s=editText.getText().toString();
webView.findAllAsync(s);
} public void next(View view)
{
webView.findNext(true);
}