I have a layout where the开发者_如何学Cre are buttons at the top and bottom of a screen with a large webview in the center between the buttons. When a link in webview is clicked, the webview becomes full-screen, but I want to keep the buttons and retain the original layout. How can this be done?
My webview is simple and looks like this:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
WebView myWebView = (WebView) findViewById(R.id.webview);
myWebView.getSettings().setJavaScriptEnabled(true);
myWebView.loadUrl("http://ya-dee-ya");
;
;
}
Set webview client and use shouldOverrideUrlLoading
myWebView.setWebViewClient(new WebViewClient(){
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
// TODO Auto-generated method stub
return super.shouldOverrideUrlLoading(view, url);
}
});
In My Point of view, You have to do Something with that XML file. . Just set the top and bottom margin of the Webview according to the height of that buttons. it will show the Buttons while you are loading the webview. . .
精彩评论