How to display a website and a button in one activity?
I'm making an application that contains button's and those buttons control an embedded browser. My problem is that I want to see the button's and the web page in the same layout, but when i click o开发者_开发知识库n a button this will open a web page and don't show the button, can anyone help me?
If I understand correctly your problem is that following a link opens the standard browser not your WebView
, right ?
Add this to your WebView
to change that behavior
// this is to prevent that when clicking a new URL from the displayed
// page the default web browser launches
webView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
});
You need to use a Layout that supports more than one child. Take a look here
精彩评论