0
爲ZTE Optik平板電腦開發,該平板電腦底部有用於後退,首頁等的浮動按鈕。除非應用程序明確要求,菜單按鈕不會顯示(顯然)。當我在平板電腦上打開MyFitnessPal時,會出現菜單按鈕。但是,當向我的應用程序添加選項菜單時,菜單按鈕從不出現。 OnCreateOptionsMenu永遠不會被調用(或至少該斷點不捕捉)。我試圖把菜單放在TabbedActivity本身以及Activity上。MonoDroid選項菜單不顯示
MainMenu.xml
<?xml version="1.0" encoding="utf-8" ?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/sendLog"
android:title="Send Log"></item>
</menu>
MainMenu.cs
public override bool OnCreateOptionsMenu(IMenu menu)
{
MenuInflater menuInflater = MenuInflater;
menuInflater.Inflate(Resource.Menu.MainMenu, menu);
return true;
}
public override bool OnOptionsItemSelected(IMenuItem item)
{
switch (item.ItemId)
{
case Resource.Id.sendLog:
var query = new SQLite("Select * From Log", true);
SqliteDataReader dr = query.dr;
List<logInfo> logs = new List<logInfo>();
while (dr.Read())
{
logInfo log = new logInfo
{
DateTime = dr["DateTime"].ToString(),
Call = dr["Call"].ToString(),
Activity = dr["Activity"].ToString(),
Message = dr["Message"].ToString()
};
logs.Add(log);
}
InventoryApp inst = new InventoryApp();
inst.sendLog(logs.ToArray());
return true;
default:
return base.OnOptionsItemSelected(item);
}
}
我不懷疑這是我失蹤的蠢事,但如果你打算投我票,請給出一個理由! – jmease 2012-04-12 21:05:48
up-voted你,我不知道爲什麼有人會投票這個問題.... – harsimranb 2012-05-26 22:19:08