C # An error is reported when mobile development MasterDetailPage is disabled,

Source: Internet
Author: User

C # An error is reported when mobile development MasterDetailPage is disabled,

The MasterDetailPage of the previous post is the main App. After 10 days, I finally knew the problem ..

What we see with tears is that there is only one code to solve this problem.

In MainActivity. cs

[Activity (Label = "INFOnDoor333 ",
MainLauncher = true,
Icon = "@ drawable/icon ",
Theme = "@ style/MainTheme ",

// Insert the following sentence
ScreenOrientation = ScreenOrientation. Portrait,

ConfigurationChanges = ConfigChanges. ScreenSize | ConfigChanges. Orientation)]

Public class MainActivity: Xamarin. Forms. Platform. Android. FormsAppCompatActivity

(The following nonsense can be ignored)

Search http://blog.csdn.net/u012565963/article/details/37561965

Portrait is always displayed vertically and does not trigger certain events.

The default value of ScreenOrientation will prompt an exception when it is disabled )...

Although I have roughly learned the lifecycle, I still don't quite understand why exceptions will occur by default.

However, it takes enough effort to find a problem.

The first solution was to download many MasterDetailPage examples, including

No matter how much it is downloaded, It is searched all over China and abroad.

When I first read the official website, there will be no error or drama, but what the title cannot hide?

Compared with the code, it is found that MainActivity inherits differently:

// Public class MainActivity: Xamarin. Forms. Platform. Android. FormsApplicationActivity // The public class MainActivity: Xamarin. Forms. Platform. Android. FormsAppCompatActivity is created on vs2017.

 

Baidu seems to be a skin, so the official website is created in the old version and abandoned.

So BaiduFormsAppCompatActivityLet's see what we get.

Https://blog.xamarin.com/material-design-for-your-xamarin-forms-android-apps/

No error will be reported when you disable the service. The result is that I have to vomit all my views.

Step by step parsing (delete !) I made the worst plan to determine which part is not too much, and used this example to change my project.

There are only a few words, which are probably relatively forgetful. After all, it took 10 days to understand the problem. Of course, there are various other things to be filled in, too many pitfalls.

 

 

-- All websites except the blog site are infringing and published. Original Website:

https://home.cnblogs.com/u/zlyxm/

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.