简体   繁体   中英

Change Fragment layout on orientation change from layout and layout-land

I'he tried for this answer but its disappears my view on change orientation.

thanks for help

You just need to create a Fragment class, call it from Activity.Then create layout-land folder,put same layout file in both layout and layout-land folder.Now you can use background according to your requirement for portrait and landscape mode. In Manifest

<activity android:name="com.example.MainActivity" >

You don't need to use onConfigurationChanged() for this operation,this will automatically call xml from layout in portrait mode and from layout-land in landscape mode.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM