在学习TTS时,我穿过以下法典:
speakBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
mTts.speak(words.getText().toString(), TextToSpeech.QUEUE_ADD, null);
}});
我确实是 Java的新鲜事,因此我对确定各种构造的信任程度是巨大的。 我认为,以上是,但new OnClickListener ()与我混淆。 因此,请确认和/或纠正以下任何一项谅解:
- The inner class is defined right after new OnClickListener().
- OnClickListener is a super class from which the inner class is derived.
- The (anonymous) inner class has only one member function: OnClick().
- What is @Override inside the definition of the inner class? If this is an annotation, then I am confused as this answer states that anonymous inner classes cannot be annotated.
最后,能否用像我这样宽松的方式来撰写上述雕像?