[英]How to auto adjust the views in Android Studio 3.0 according to the screen size of the device
[英]How to resize the webview According to the size of device Screen in android studio
我已經創建了一個帶有網絡視圖的android studio項目。 Web視圖包含響應式網站。 我已經用智能手機(nokia3)測試了我的應用程序。 但我不知道它如何與Tab一起使用。 因為我沒有平板電腦。 但是我找到了一些解決方案,您能告訴我哪個是正確的嗎?
A:
mWebView.getSettings().setUseWideViewPort(true);
mWebView.getSettings().setLoadWithOverviewMode(true);
B:
WebSettings webSettings = appView.getSettings();
webSettings.setUseWideViewPort(true);
webSettings.setLoadWithOverviewMode(true);
兩者是相同的。 兩者在功能方面都是正確的。
您可以選擇任何一個。
A.通過直接從視圖中引用來修改Webview的設置
B.它首先獲取WebSettings
對象,然后修改其狀態。
您可以設置Webview的寬度和高度match_parent。 但請確保是否設置了填充,然后刪除填充。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.