1

I'm new to android development. So I created a responsive designed website and trying to create an android app that opens up a webview and show the website.

Followed http://developer.android.com/guide/webapps/webview.html.

Here are my codes:

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.webkit.WebSettings;
import android.webkit.WebView;

public class MainActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        WebView myWebView = (WebView) findViewById(R.id.webview);
        WebSettings webSettings = myWebView.getSettings();
        webSettings.setJavaScriptEnabled(true);
        myWebView.loadUrl("http://www.example.co");
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
}

However, when emulator fired up, it didn't give me the responsive design that the website has. But on the android default browser, it works just fine. So how can I fix this?

Thanks in advance.

tipsywacky
  • 3,374
  • 5
  • 43
  • 75

1 Answers1

1

Alright, I found the solution.

myWebView.setInitialScale(50);
tipsywacky
  • 3,374
  • 5
  • 43
  • 75