简体   繁体   中英

Android Xamarin App content

I am developing some small android app using visual studio and xamarin on C#. Application is simple for beggining, it has 3 menu items (profile, news feed, images), and i want to switch app content on menu item click. 2 approaches that i tried was creating 3 differen layouts for each of menu items, than switching them with SetContentView, and 2nd approact was creating 3 Activities each using SetContentView for every layout.

As a new developer on xamarain and generaly for android devices i am not sure about is any of these 2 methods good way to do this.

Can anyone recomend best approach for this? Thank you

You should either create separate activities or fragments for each screen you want to display. If you use activities, then you should start them with an Intent . For fragments, you should use the FragmentManager to switch fragments. There are several tutorials online about these techniques. Most of them are in Java, but you should be able to translate fairly easy.

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