i using options menu putting on navigation bar using menuinflater
after when activity created when try rotating screen see 2 icons instead of single icon.
i trying search solution how handle screen rotation event.
here activity.cs
[activity(label = "menu", icon = "@drawable/icon", configurationchanges = android.content.pm.configchanges.orientation | android.content.pm.configchanges.screensize)] public class menunavigation : listactivity { string[] items; protected override void oncreate(bundle bundle) { base.oncreate(bundle); items = new string[] { "chat", "news", "events", "member list", "my profile", "about association" ,"about application"}; listadapter = new arrayadapter<string>(this, android.resource.layout.simplelistitem1, items); } public override bool onprepareoptionsmenu(imenu menu) { menuinflater.inflate(resource.menu.main, menu); return base.onprepareoptionsmenu(menu); } }
and menu/main.xml
<?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/action_logout" android:icon="@drawable/logout" android:orderincategory="100" android:title="log out" android:showasaction="ifroom"/> </menu>
while searching solution on developer.xamarin -> handling rotation
i found solution own question. had to:
[activity(label = "menu", icon = "@drawable/icon", configurationchanges = android.content.pm.configchanges.orientation | android.content.pm.configchanges.screensize)]
configurationchanges = android.content.pm.configchanges.orientation
this has solved problem think there might better solution, other solutions appreciated.
Comments
Post a Comment