1

I have made an app for my blog. Blog looks fine while using a browser but with app it exceeds screen width. This is my blog

This is what i see from my browser (opera, yandex etc)
And the result using the app

<androidx.swiperefreshlayout.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/swipe_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <WebView
        android:id="@+id/webview"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:ignore="WebViewLayout" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

And the main activity xml

Robert
  • 39,162
  • 17
  • 99
  • 152
  • Looks like your blog doesn't have a mobile/small screen layout. The WebView is just showing what the HTML and CSS code of your blog tell it. Also you can't compare a wide desktop view with a mobile view. You can simulate a mobile view on your desktop and thus adapt your blog https://dev.opera.com/articles/opera-mobile-emulator/ – Robert Aug 20 '22 at 09:29
  • I am comparing mobile browsers not desktop – trabakoulas Aug 20 '22 at 09:36

1 Answers1

0

The solution was to add these two lines in my java file. Thanks to this answer

webView.getSettings().setUseWideViewPort(true);
webView.setInitialScale(1);