星期二, 11月 17, 2015

[Andriod] 使用按鈕觸發選單: openOptionsMenu();


使用按鈕觸發menu被顯示。
Button menuBtn = (Button)this.findViewById(R.id.topic_3_menu_button);
menuBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Log.d(TAG,"點擊功能選單鈕");
openOptionsMenu();
}


});

http://stackoverflow.com/questions/18913635/how-to-trigger-a-menu-button-click-event-through-code-in-android

沒有留言:

張貼留言

留個話吧:)

其他你感興趣的文章

Related Posts with Thumbnails