Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/179.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android WebView中只显示白色屏幕,不显示图像_Android_Url_Webview_Android Webview - Fatal编程技术网

Android WebView中只显示白色屏幕,不显示图像

Android WebView中只显示白色屏幕,不显示图像,android,url,webview,android-webview,Android,Url,Webview,Android Webview,用户应该能够在单击图像缩略图时查看图像,但是,显示的只是带有刷新按钮的白色屏幕。对于所选的所有图像,行为都是一致的,以下实现中使用了WebView方法。我试图调整宽度和高度布局,因为我怀疑图像的尺寸超出了android设备显示的范围。然而,这项整改措施并没有奏效。出了什么问题?有什么建议吗 我已附上以下代码副本供您阅读: 代码: 安卓清单 XML布局 您可以记录传递到WebView的URL吗。i、 e.这个:Log.dURL,String.formatgetStringR.String.app_

用户应该能够在单击图像缩略图时查看图像,但是,显示的只是带有刷新按钮的白色屏幕。对于所选的所有图像,行为都是一致的,以下实现中使用了WebView方法。我试图调整宽度和高度布局,因为我怀疑图像的尺寸超出了android设备显示的范围。然而,这项整改措施并没有奏效。出了什么问题?有什么建议吗

我已附上以下代码副本供您阅读:

代码:

安卓清单

XML布局


您可以记录传递到WebView的URL吗。i、 e.这个:Log.dURL,String.formatgetStringR.String.app_360_域+getStringR.String.app_360_属性+getIntent.getIntExtrapropertyId,0+getStringR.String.app_360_目录+img_id+getStringR.String.app_360_索引@samgak是的,这是可能的,下面的日志是'01-22 13:16:47.889:I/PropertyPanoramaActivity:ifpanoSize>016564:*******webView.loadUrl*****`我测试了你的部分代码,它对我有效。全景图出现,我可以环顾四周。@samgak,因为所有的图像都显示了??但是,我需要的图像不是显示的,而是一个白色屏幕。您介意分享您可能采取的注意事项吗?我使用了一个带有单个WebView的XML布局,并使用您的代码初始化WebView,直到但不包括ifpanosize>0语句。然后,我从setOnItemClickListener函数内部复制了代码,并加载了Url。它打开了全景。
webView = (WebView) findViewById(R.id.webview01);
        webView.setBackgroundColor(0x00000000);
        webView.getSettings().setJavaScriptEnabled(true);
        //webView.getSettings().setPluginState(PluginState.ON);
        webView.setVerticalScrollBarEnabled(false);
        webView.setHorizontalScrollBarEnabled(false);
        webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(false);
        webView.getSettings().setSupportMultipleWindows(false);
        webView.getSettings().setSupportZoom(false);
        webView.invalidate();
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        webView.getSettings().setUseWideViewPort(true);
        webView.setInitialScale(1);

        webView.setWebViewClient(new WebViewClient() {
            public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
                Toast.makeText(getContext(), description, Toast.LENGTH_SHORT).show();
            }
        });
        webView.setWebChromeClient(new WebChromeClient() {
            @Override
            public void onProgressChanged(WebView view, int newProgress) {
                // TODO Auto-generated method stub
                super.onProgressChanged(view, newProgress);
                photoPb.setProgress(newProgress);
                if (newProgress != 100) {
                    photoPb.setVisibility(View.VISIBLE);
                } else {
                    if (apb == null)
                        apb = new BgPbAsyncTask().execute();
                    else if (apb.getStatus() != AsyncTask.Status.RUNNING
                            && apb.getStatus() != AsyncTask.Status.PENDING)
                        apb = new BgPbAsyncTask().execute();
                }
            }
        });
        if (panoSize > 0) {
            g = (Gallery) findViewById(R.id.gallery01);
            g.setAdapter(new ImageAdapter());
            int pad = 15;
            g.setSpacing(1);
            g.setUnselectedAlpha(255);
            g.setPadding(pad, 10, pad, pad);
            g.setOnItemClickListener(new OnItemClickListener() {
                public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
                    img_id = position+1;
                    setImageShade(position);
                    captionText.setText(caption[position]);

                    Log.i("PropertyPanoramaActvity:if(panoSize>0)","******webView.loadUrl******"+getString(R.string.app_360_domain)+getString(R.string.app_360_property)+(getIntent().getIntExtra("propertyId", 0))+getString(R.string.app_360_directory)+(img_id)+getString(R.string.app_360_index));

                    webView.loadUrl(String.format(getString(R.string.app_360_domain)
                            +getString(R.string.app_360_property)+(getIntent().getIntExtra("propertyId", 0))
                            +getString(R.string.app_360_directory)+img_id
                            +getString(R.string.app_360_index)));

                    /*if (flashInstalled) {
                        webView.loadUrl(img[position].getPanoUrl());   
                    } else {
                        webView.loadUrl(String.format("https://developer.dapoltd.com/spacetobe_uat/data/images/property/property107/360/4/index.htm", id, img_id));

                        //webView.loadUrl(getString(R.string.wap_domain) + getString(R.string.wap_flashnotsupported));
                    }*/

                }
            });
        }
 <uses-permission android:name="android.permission.INTERNET" >
</uses-permission>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" >
</uses-permission><uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /><uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" >
</uses-permission>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:orientation="vertical" android:background="@color/transparent">
<include layout="@layout/header" />
<include layout="@layout/property_nav" />
<RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:padding="10dp"
    android:background="@color/transparent">
    <include layout="@layout/property_share" />
</RelativeLayout>
<LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:paddingRight="10dp"
    android:paddingLeft="10dp" android:layout_weight="1" android:orientation="vertical">
    <WebView android:id="@+id/webview01" android:layout_width="fill_parent" android:layout_height="fill_parent"
        android:layout_weight="4"></WebView>
    <ProgressBar android:id="@+id/photoPb" android:layout_width="fill_parent" android:layout_height="5dp"
        style="@android:style/Widget.ProgressBar.Horizontal" />
</LinearLayout>

<TextView
    android:id="@+id/caption"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:gravity="center_horizontal"
    android:textAppearance="?android:attr/textAppearanceSmall"
    android:textColor="@color/white" />

<Gallery android:id="@+id/gallery01" android:layout_width="fill_parent" android:layout_height="wrap_content" />
<include layout="@layout/mainmenu" />