1

I just started the Android Studio two days ago and I've never experienced Java before. However, I know the language to build a website. I've finished creating a hybrid app to render my website as an app in a WebView. I want to change the design and the title of AlertDialog from my WebView, how could I do it?

MainActivity.java

public class MainActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        WebView WebView01 = (WebView) findViewById(R.id.webView);
        WebView01.setWebChromeClient(new WebChromeClient());
        WebView01.setWebViewClient(new WebViewClient());
        WebSettings webSettings = WebView01.getSettings();
        webSettings.setJavaScriptEnabled(true);
        webSettings.setUseWideViewPort(true);
        webSettings.setBuiltInZoomControls(false);
        webSettings.setAllowUniversalAccessFromFileURLs(true);
        webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
        webSettings.setSupportMultipleWindows(true);
        webSettings.setSaveFormData(false);
        webSettings.setSavePassword(true);
        webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
        WebView01.loadUrl("http://url");
    }
}
Blo
  • 11,903
  • 5
  • 45
  • 99
정형석
  • 139
  • 1
  • 7

1 Answers1

0

There are many tutorials available online. You can create custom AlertDialog and you can give whatever design you want and load WebView on that AlertDialog

create a custom dialog box

Android custom dialog example

How to create a Custom Dialog box in android?

Community
  • 1
  • 1
madhan kumar
  • 1,560
  • 2
  • 26
  • 36
  • Thank you for your response. Can I ask you to let me know that alert of web is a AlertDailog from the app? – 정형석 Dec 24 '16 at 04:03
  • No, `AlertDialog` in android and `Alert` in web both are different. Load `Webview` inside the `AlertDialog` and if you have `Alert` inside the webview then it not get effect and you can design that `Alert` using html and css.. – madhan kumar Dec 24 '16 at 04:14
  • I don't understand all the contents, but I think I know what you mean. Then, can I change Alert to AlertDialog? Because I know that I can not change a html and css using Alert. – 정형석 Dec 24 '16 at 04:31