我想要的是有一个选项菜单,用户可以选择在以下菜单之间导航:
就像现在一样,我已经创建了我的按钮OnClickListener和手势GestureOverlayView.然后我选择开始一个新的,Activity取决于使用按下按钮还是执行手势.但是,当我尝试绘制手势时,它不会被拾取.仅识别按钮.以下是我的代码:
public class Menu extends Activity implements OnClickListener, OnGesturePerformedListener {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//create TextToSpeech
myTTS = new TextToSpeech(this, this);
myTTS.setLanguage(Locale.US);
//create Gestures
mLibrary = GestureLibraries.fromRawResource(this, R.raw.gestures);
if (!mLibrary.load()) {
finish();
}
// Set up click listeners for all the buttons.
View playButton = findViewById(R.id.play_button);
playButton.setOnClickListener(this);
View instructionsButton = findViewById(R.id.instructions_button);
instructionsButton.setOnClickListener(this);
View modeButton = findViewById(R.id.mode_button);
modeButton.setOnClickListener(this);
View statsButton = findViewById(R.id.stats_button);
statsButton.setOnClickListener(this);
View exitButton = findViewById(R.id.exit_button); …Run Code Online (Sandbox Code Playgroud)