Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在创建一个带有允许水平分页的 viewpager 的应用程序。在您在应用程序上滑动的窗格上,有按钮播放声音并链接到其他页面等。该应用程序运行良好,但我不知道如何编程viewpager 中的按钮。任何人都可以提供一个例子,或者帮助我吗?
对按钮进行编程以做什么?人们通常通过在代码中使用类似这样的方法来处理 UI 小部件
Button aButton = (Button) findViewById(R.id.aButton);
然后为 aButton 创建一个监听器
aButton.setOnClickListener(new OnClickListener(View v) { ... });