0

fullscreenwrapper2 と sl4a で OptionsMenuItem のイベント ハンドラを作成するには?

    FullScreenWrapper2App.get_android_instance().addOptionsMenuItem("Exit","exit",None,"ic_menu_revert") # adding exit options successfully, but how to make event handler of this?
    self.views.exit.add_event(click_EventHandler(self.views.exit, self.close_out)) #this is works, trigger close_out function when clicked.
    self.views.but_exit.add_event(click_EventHandler("exit", self.close_out)) # and this is too! this is works, trigger close_out function when clicked.

誰でも汗をかくことができますか?

4

1 に答える 1

0

私自身の問題を解決しました。add_event(EventHandler())OptionsMenuItem 自体のハンドラーとして使用します。

class MainScreen(Layout):
    def __init__(self):
        #initialize your class data attributes
        #load & set your xml
        super(MainScreen,self).__init__(pathhelpers.read_layout_xml("main.xml"),"Some title")

    def on_show(self):
    FullScreenWrapper2App.get_android_instance().addOptionsMenuItem("Exit",'exit','exit',"ic_menu_revert")
    self.add_event(EventHandler("exit", None, None, None, self.close_out))
于 2012-11-21T04:45:48.680 に答える