import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; public class IndexActivity extends AppCompatActivity { private Button btnS01E01; private Button btnS01E02; private Button btnS01E03; private Button btnS01E04; private Button btnS01E05; private Button btnS01E06; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_index); btnS01E01 = (Button)findViewById(R.id.btnS01E01); btnS01E02 = (Button)findViewById(R.id.btnS01E02); btnS01E03 = (Button)findViewById(R.id.btnS01E03); btnS01E04 = (Button)findViewById(R.id.btnS01E04); btnS01E05 = (Button)findViewById(R.id.
一个监听器绑定多个按钮控件
最新推荐文章于 2023-05-24 20:05:56 发布
该博客介绍了如何在Android应用中使用同一个监听器ButtonListener为多个按钮设置点击事件。每个按钮点击后会启动不同的Activity,例如btnS01E01点击后启动S01E01Activity,以此类推。
摘要由CSDN通过智能技术生成