I am not using a layout-land, but do have drawable-land.
The problem is, it uses whichever drawable matches the orientation when the activity starts. I would like it to switch between using the drawable/drawable-land when the开发者_如何学C phone rotates. Is there a way to do this easily? Or should I just copy and paste my layout into layout-land, so that it actually recreates the activity? (I assume that would do the right thing, but ideally I would like it to just refresh the drawable using the correct one when I rotate)
you can check first device orientation ie manually by
Display mDisplay= activity.getWindowManager().getDefaultDisplay();
int width= mDisplay.getWidth();
int Height= mDisplay.getHeight();
if(width>height)
{
//Landscape
//set your landscape drawable
}
else
{
//portrait
//set your portrait drawable
}
so then no need to create "Drawable-land" folder also
精彩评论