0

ヒント:以前は私と一緒に働いていましたが、単純に何が起こったのかわかりません。検索アイコンをクリックすると、展開されず、logcat でこれが表示されます。これは例外ではありません。

06-23 06:51:40.316: D/SherlockFragmentActivity(2027): [onMenuItemSelected] featureId: 0, item: Search
06-23 06:51:40.316: D/ActionBarSherlock(2027): [dispatchOptionsItemSelected] item: Search
06-23 06:51:40.316: D/ActionBarSherlock(2027): [callbackOptionsItemSelected] item: Search
06-23 06:51:40.316: D/Watson(2027): [onMenuItemSelected] featureId: 0, item: com.actionbarsherlock.internal.view.menu.MenuItemWrapper@4187d4b0
06-23 06:51:40.316: D/SherlockFragmentActivity(2027): [supportInvalidateOptionsMenu]
06-23 06:51:40.316: D/SherlockFragmentActivity(2027): [invalidateOptionsMenu]
06-23 06:51:40.316: D/ActionBarSherlock(2027): [dispatchInvalidateOptionsMenu]
06-23 06:51:40.438: D/SherlockFragmentActivity(2027): [onCreatePanelMenu] featureId: 0, menu: com.android.internal.view.menu.MenuBuilder@41825968
06-23 06:51:40.438: D/ActionBarSherlock(2027): [dispatchCreateOptionsMenu] menu: com.android.internal.view.menu.MenuBuilder@41825968
06-23 06:51:40.450: D/ActionBarSherlock(2027): [callbackCreateOptionsMenu] menu: com.actionbarsherlock.internal.view.menu.MenuWrapper@41828208
06-23 06:51:40.450: D/Watson(2027): [onCreatePanelMenu] featureId: 0, menu: com.actionbarsherlock.internal.view.menu.MenuWrapper@41828208
06-23 06:51:40.450: D/SherlockFragmentActivity(2027): [getSupportMenuInflater]
06-23 06:51:40.467: D/ActionBarSherlock(2027): [getMenuInflater]
06-23 06:51:40.766: D/Watson(2027): [onCreatePanelMenu] activity create result: true
06-23 06:51:40.766: D/SherlockFragmentActivity(2027): [getSupportMenuInflater]
06-23 06:51:40.766: D/ActionBarSherlock(2027): [getMenuInflater]
06-23 06:51:40.776: D/Watson(2027): [onCreatePanelMenu] fragments create result: false
06-23 06:51:40.776: D/Watson(2027): [onCreatePanelMenu] returning true
06-23 06:51:40.776: D/ActionBarSherlock(2027): [callbackCreateOptionsMenu] returning true
06-23 06:51:40.776: D/ActionBarSherlock(2027): [dispatchCreateOptionsMenu] returning true
06-23 06:51:40.797: D/SherlockFragmentActivity(2027): [onCreatePanelMenu] returning true
06-23 06:51:40.916: D/SherlockFragmentActivity(2027): [onPreparePanel] featureId: 0, view: null, menu: com.android.internal.view.menu.MenuBuilder@41825968
06-23 06:51:40.916: D/ActionBarSherlock(2027): [dispatchPrepareOptionsMenu] menu: com.android.internal.view.menu.MenuBuilder@41825968
06-23 06:51:40.916: D/ActionBarSherlock(2027): [callbackPrepareOptionsMenu] menu: com.actionbarsherlock.internal.view.menu.MenuWrapper@41828208
06-23 06:51:40.916: D/Watson(2027): [onPreparePanel] featureId: 0, view: null menu: com.actionbarsherlock.internal.view.menu.MenuWrapper@41828208
06-23 06:51:40.926: D/Watson(2027): [onPreparePanel] activity prepare result: true
06-23 06:51:40.926: D/Watson(2027): [onPreparePanel] fragments prepare result: false
06-23 06:51:40.926: D/Watson(2027): [onPreparePanel] returning true
06-23 06:51:40.926: D/ActionBarSherlock(2027): [callbackPrepareOptionsMenu] returning true
06-23 06:51:40.926: D/ActionBarSherlock(2027): [dispatchPrepareOptionsMenu] returning true
06-23 06:51:40.926: D/SherlockFragmentActivity(2027): [onPreparePanel] returning true
06-23 06:51:41.016: D/SherlockFragmentActivity(2027): [invalidateOptionsMenu]
06-23 06:51:41.016: D/ActionBarSherlock(2027): [dispatchInvalidateOptionsMenu]
06-23 06:51:41.079: D/SherlockFragmentActivity(2027): [onCreatePanelMenu] featureId: 0, menu: com.android.internal.view.menu.MenuBuilder@41825968
06-23 06:51:41.097: D/ActionBarSherlock(2027): [dispatchCreateOptionsMenu] menu: com.android.internal.view.menu.MenuBuilder@41825968
06-23 06:51:41.097: D/ActionBarSherlock(2027): [callbackCreateOptionsMenu] menu: com.actionbarsherlock.internal.view.menu.MenuWrapper@41828208
06-23 06:51:41.108: D/Watson(2027): [onCreatePanelMenu] featureId: 0, menu: com.actionbarsherlock.internal.view.menu.MenuWrapper@41828208
06-23 06:51:41.108: D/SherlockFragmentActivity(2027): [getSupportMenuInflater]
06-23 06:51:41.108: D/ActionBarSherlock(2027): [getMenuInflater]
06-23 06:51:41.316: D/Watson(2027): [onCreatePanelMenu] activity create result: true
06-23 06:51:41.316: D/SherlockFragmentActivity(2027): [getSupportMenuInflater]
06-23 06:51:41.316: D/ActionBarSherlock(2027): [getMenuInflater]
06-23 06:51:41.316: D/Watson(2027): [onCreatePanelMenu] fragments create result: false
06-23 06:51:41.316: D/Watson(2027): [onCreatePanelMenu] returning true
06-23 06:51:41.316: D/ActionBarSherlock(2027): [callbackCreateOptionsMenu] returning true
06-23 06:51:41.316: D/ActionBarSherlock(2027): [dispatchCreateOptionsMenu] returning true
06-23 06:51:41.316: D/SherlockFragmentActivity(2027): [onCreatePanelMenu] returning true
06-23 06:51:41.340: D/SherlockFragmentActivity(2027): [onPreparePanel] featureId: 0, view: null, menu: com.android.internal.view.menu.MenuBuilder@41825968
06-23 06:51:41.352: D/ActionBarSherlock(2027): [dispatchPrepareOptionsMenu] menu: com.android.internal.view.menu.MenuBuilder@41825968
06-23 06:51:41.352: D/ActionBarSherlock(2027): [callbackPrepareOptionsMenu] menu: com.actionbarsherlock.internal.view.menu.MenuWrapper@41828208
06-23 06:51:41.352: D/Watson(2027): [onPreparePanel] featureId: 0, view: null menu: com.actionbarsherlock.internal.view.menu.MenuWrapper@41828208
06-23 06:51:41.388: D/Watson(2027): [onPreparePanel] activity prepare result: true
06-23 06:51:41.388: D/Watson(2027): [onPreparePanel] fragments prepare result: false
06-23 06:51:41.388: D/Watson(2027): [onPreparePanel] returning true
06-23 06:51:41.388: D/ActionBarSherlock(2027): [callbackPrepareOptionsMenu] returning true
06-23 06:51:41.388: D/ActionBarSherlock(2027): [dispatchPrepareOptionsMenu] returning true
06-23 06:51:41.388: D/SherlockFragmentActivity(2027): [onPreparePanel] returning true
06-23 06:51:41.406: D/ActionBarSherlock(2027): [callbackOptionsItemSelected] returning false
06-23 06:51:41.406: D/ActionBarSherlock(2027): [dispatchOptionsItemSelected] returning false
06-23 06:51:41.406: D/SherlockFragmentActivity(2027): [onMenuItemSelected] returning false
06-23 06:51:41.536: I/Choreographer(2027): Skipped 125 frames!  The application may be doing too much work on its main thread.

これは検索のメニューxmlです

<item
        android:id="@+id/menu_search"
        android:actionViewClass="android.widget.SearchView"
        android:icon="@drawable/action_search"
        android:showAsAction="ifRoom|collapseActionView"
        android:title="@string/menu_search"/>
4

1 に答える 1

0

機能のせいだった

supportInvalidateOptionsMenu();
invalidateOptionsMenu();

onOptionsMenuClosed()、OnOptionsItemSelectedListener()、onOptionsItemSelected() で呼び出されたもの

これらの関数からそれらを削除し、OnCreate() メソッドのみに配置しました。これらの関数の目的は、オプション メニューが変更されたため、再作成する必要があることを宣言することです。onCreateOptionsMenu(Menu) メソッドは、次に表示する必要があるときに呼び出されます。

于 2013-06-23T06:54:27.767 に答える