I have a linear layout wrapping a button, a gridview and a textview set in a xml file. When the screen is in portrait orientation all these elements are displayed fine. However, when I change the orientation of the screen into landscape orientation the textview disappears. I'd like to change the layout on configuration change. I'd like to display the elements horizontally in a way that each of them takes up a certain percentage of the screen. I also have to change the number of items shown per row in the gridview, and maybe some others parameters. Until now I have this, but i don't know how to change the rest of the parameters.
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
LinearLayout linearlayout= (LinearLayout) findViewById(R.id.LinearLayout02);
GridView gridview=(GridView) findViewById(R.id.gridview);
if(newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE){
linearlayout.setOrientation(LinearLayout.HORIZONTAL);
}
else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
linearlayout.setOrientation(LinearLayout.VERTICAL);
}
}