0

I am trying to translate the following into C# with Dot 42

@Override public boolean onOptionsItemSelected(MenuItem item) 
{ 
    switch (item.getItemId()) 
{ 
       case android.R.id.home: 
            return(true);
       case R.id.about: 
            return(true);
       case R.id.help: 
            return(true);
}
return(super.onOptionsItemSelected(item));
}

My main problem right now is the android.id.home The Intellisense does not show a Home member of Android.R.Id What am I missing here? BTW if you would like to translate the full block into C#, thanks, but I'm pretty sure the rest of it will not pose much a problem.

4

1 回答 1

0
public override bool OnOptionsItemSelected(Android.View.IMenuItem item)
{
    switch (item.GetItemId())
    {
        case Android.R.Id.Home: // API level 11 and higher (Android 3.0) 
            return (true);
        case R.Id.About:
            return (true);
        case R.Id.Help:
            return (true);
    }
    return (base.OnOptionsItemSelected(item));
}

请注意,它R.Id.Home标识平台中的资源,因此是Android范围。

在此处输入图像描述

假设AboutHelp是应用程序资源标识符。

于 2014-01-19T20:35:02.070 回答