English 中文(简体)
Capacitor on Andable to “caldown” page using viewport
原标题:Capacitor on Android Unable to "scale down" page using viewport

1. 如果你创建带有任何内容的基本超文本网页,并添加:

<meta name=“viewport” content=“user-scalable=no, width=500px, first-pan=0.1, minimum-pan=0.1,max-pan=10”/>

然后,在你本人的PC或你和roid的电话上打开这门话,你会看到内容按照你的期望缩小。

“在此处的影像描述”/</a

Now do the same in a Capacitor app and see the content it isnt scaled down.

“entergraph

为什么如此? 为什么在网上浏览器中扩大浏览器但NOT中的工作范围?

注:可以将<代码>初始尺度设定为更大的价值2,例如,这既可操作浏览器,又可操作实际上很奇怪的索引。

“entergraph

就完整性而言,这是我为上述图像所用的整个超文本:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <base href="/" />
    <meta name="viewport" content="user-scalable=no, width=500px, initial-scale=0.3, minimum-scale=0.1, maximum-scale=10" />
  </head>
  <body>
    <div style="width: 500px; background: red">500px wide</div>
    <div style="width: 100dvw; background: purple">100dvw</div>
    <div style="width: 200px; background: green">200px wide</div>
    <div style="width: 100px; background: blue">100px wide</div>
    <div style="font-size: 10em">HELLO WORLD THIS IS SOME TEXT!</div>
  </body>
</html>
问题回答

典型! 一旦我提出这个问题,我就不解回答(在ChanetGPT的帮助下)。

您必须在 Java方的网上意见上将这两条放在<条码>真实性上:

    webSettings.setUseWideViewPort(true);
    webSettings.setLoadWithOverviewMode(true);

我的<代码>MainActative.java的全代码(简称包件)。 looks:

import com.getcapacitor.BridgeActivity;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;

public class MainActivity extends BridgeActivity {

 @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Grab WebView
    WebView webView = (WebView) findViewById(R.id.webview);
    WebSettings webSettings = webView.getSettings();

    // The Magic
    webSettings.setUseWideViewPort(true);
    webSettings.setLoadWithOverviewMode(true);
  }
}

为此,你必须给你写信。 Edit active_main.xml so that the WebView tag so that:

    <WebView
        android:id="@+id/webview"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

而现在,它工作! 你们可以缩小规模,提升!





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签