Reputation: 4408
I have a webview pat of my activity layout I have a button "fullscreen" On clicking this i want the webview to occupy the full screen.
I have tried elativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.FILL_PARENT); webview.setLayoutParams(params);
But with this, 1. the button "fullscreen" that is specified to be aligned to bottom is still visible
Is there any other way to get full screen dynamically
Upvotes: 0
Views: 1164
Reputation: 5208
If you press the Fullscreen Button, just remove the Button from the main view group. Now you have to overwrite the onKeyPressed and the onBackPressed method to make Android not go back to the previous Activity and make the Button visible again.
@Override
public void onBackPressed() {
...
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
...
return true;
} else {
return super.onKeyDown(keyCode, event);
}
}
Upvotes: 1