将滚动视图添加到 Web 视图

问题描述

我基本上是在尝试向 Web 视图添加滚动视图,因为在模拟器上我只能看到地图:

enter image description here

当我应该使用“完成”和“帮助”按钮查看它时:

enter image description here

所以我尝试了几个选项来获得合适的滚动条,首先我在 WebView 对象的构建滚动条方法中使用。

    public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_more_option_track_delivery,container,false);
        purchaSEOrderSingleResponse = (PurchaSEOrderSingleResponse) getArguments().getSerializable(PURCHASE_ORDER_RESPONSE);
        mapView = (WebView) view.findViewById(R.id.mapWebView);
        mapView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
        mapView.setScrollbarFadingEnabled(false);
        mapView.loadUrl(purchaSEOrderSingleResponse.getDeliveryInfo().getDeliveryGatewayInfo().getTrackingUrl());
        WebSettings webSettings = mapView.getSettings();
        webSettings.setJavaScriptEnabled(true);
        mapView.setWebViewClient(new WebViewClient());
        return view;
    }

然而这仍然不起作用,接下来我尝试在 xml 本身的 Web 视图中添加一个滚动视图:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/white"
    tools:context="io.apptizer.pos.fragment.purchaSEOrderDetailtab.moreOptionsActivity.TrackDeliveryFragment">

    <ScrollView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
    <RelativeLayout
        android:id="@+id/moreOptionsScreenNotifyCustomerLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:visibility="visible"
        xmlns:android="http://schemas.android.com/apk/res/android">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="500dp"
                android:padding="10dp"
                android:orientation="vertical">
                <WebView
                    android:id="@+id/mapWebView"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent" />
            </LinearLayout>
    </RelativeLayout>
    </ScrollView>
</FrameLayout>

这也不管用,我什至试过这个方法

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/white"
    tools:context="io.apptizer.pos.fragment.purchaSEOrderDetailtab.moreOptionsActivity.TrackDeliveryFragment">


    <RelativeLayout
        android:id="@+id/moreOptionsScreenNotifyCustomerLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:visibility="visible"
        xmlns:android="http://schemas.android.com/apk/res/android">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="500dp"
                android:padding="10dp"
                android:orientation="vertical">
                <ScrollView
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:fillViewport="true">
                <WebView
                    android:id="@+id/mapWebView"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent" />
                </ScrollView>
            </LinearLayout>
    </RelativeLayout>
</FrameLayout>

而且我仍然看不到我要显示的网址的以下按钮。有关信息,这是我要显示的网络视图网址:https://postmates.com/track/del_N-9HNMuPfFr_H-

我的主要问题是我无法看到带有按钮和所有内容的完整网络视图,我只能看到地图,我正在尝试向其添加滚动视图但它不起作用。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...