<activity android:configChanges="orientation|screenSize" android:icon="@drawable/a512" android:label="KMI" android:theme="@style/MainTheme" android:name="md5ce51fed3f5ce2f508bfc10049c6540f6.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
问题似乎出在这里configchanges部分。有什么办法可以解决?我确实尝试删除了它,但是它又回来了,并且出现了同样的错误。
[Activity(Label = "KMI", Icon = "@drawable/a512", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
答案 0 :(得分:0)
如果您使用Xamarin,最好在Activity类文件的Activity Attribute中提供它们。假设您想在MainActivity
文件中执行此操作。然后,您可以执行以下操作:
[Activity(ScreenOrientation = ScreenOrientation.Portrait, Theme = "@style/MyTheme", ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity : global:: Xamarin.Forms.Platform.Android.FormsAppCompatActivity