Android 未调用OnOption
我已通过编程方式将菜单项添加到操作栏的溢出区域。 我还创建了onOptionsItemsSelected方法。 然而,当我点击溢出菜单中的选项时,我得到以下错误:- I/ListPopupWindow:在上找不到方法setEpicenterBounds(Rect) 砰砰的一声。哦,好吧。03-19 05:49:33.907 18143-18143/com.cs478.arjan.a3 W/art:Android 4.1之前,方法int android.support.v7.widget.ListViewCompat.lookForSelectablePosition(int, boolean)将错误地重写包私有方法 在android.widget.ListView 03-19 05:49:34.876中 18143-18143/com.cs478.arjan.a3 I/编舞:跳过49帧! 应用程序可能在其主线程上做了太多工作。03-19 05:51:00.461 1258-1577/? D/hw作曲家:hw_作曲家在中发送了216次同步 119s 03-19 05:51:55.146 3080-3086/com.cs478.arjan.a2 W/艺术:暂停 所有线程耗时:35.702ms 我将我的类定义为:-Android 未调用OnOption,android,android-actionbar,Android,Android Actionbar,我已通过编程方式将菜单项添加到操作栏的溢出区域。 我还创建了onOptionsItemsSelected方法。 然而,当我点击溢出菜单中的选项时,我得到以下错误:- I/ListPopupWindow:在上找不到方法setEpicenterBounds(Rect) 砰砰的一声。哦,好吧。03-19 05:49:33.907 18143-18143/com.cs478.arjan.a3 W/art:Android 4.1之前,方法int android.support.v7.widget.List
public class Basketball extends AppCompatActivity implements ListSelectionListener {
private android.app.ActionBar a;
...
public boolean onCreateOptionsMenu(Menu menu){
menu.add(Menu.NONE, 1, Menu.NONE, "Baseball");
return true;
}
public boolean onOptionsItemsSelected(MenuItem item){
Log.i("project III",TAG+" in optionsItems Selected");
switch (item.getItemId()){
case 1:
Intent intent = new Intent(Basketball.this,Baseball.class);
startActivity(intent);
break;
}
return true;
}
...
}
如有任何解决此问题的建议,我们将不胜感激
问候
Arjan写入覆盖方法:
public class Basketball extends AppCompatActivity implements ListSelectionListener {
private android.app.ActionBar a;
...
@Override
public boolean onCreateOptionsMenu(Menu menu){
menu.add(Menu.NONE, 1, Menu.NONE, "Baseball");
return true;
}
@Override
public boolean onOptionsItemsSelected(MenuItem item){
Log.i("project III",TAG+" in optionsItems Selected");
switch (item.getItemId()){
case 1:
Intent intent = new Intent(Basketball.this,Baseball.class);
startActivity(intent);
break;
}
return true;
}
...
}
重写方法:
public class Basketball extends AppCompatActivity implements ListSelectionListener {
private android.app.ActionBar a;
...
@Override
public boolean onCreateOptionsMenu(Menu menu){
menu.add(Menu.NONE, 1, Menu.NONE, "Baseball");
return true;
}
@Override
public boolean onOptionsItemsSelected(MenuItem item){
Log.i("project III",TAG+" in optionsItems Selected");
switch (item.getItemId()){
case 1:
Intent intent = new Intent(Basketball.this,Baseball.class);
startActivity(intent);
break;
}
return true;
}
...
}
我认为@override在这种情况下丢失了,android不会调用它。请检查。我认为@override在这种情况下丢失了,android不会调用它。请检查。非常感谢。非常感谢。