播放上触碰的声音? [英] Play a sound on touch?

查看:130
本文介绍了播放上触碰的声音?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在做一个简单的气泡布的应用程序,以了解Android框架,并想知道我怎么能玩'流行'的每个用户触摸泡沫时声音片段。

I was working on a simple bubblewrap app in order to learn the android framework, and was wondering how I could play the 'pop' sound clip every time the user touches a bubble.

在此先感谢

推荐答案

使用的Soundpool 结合的 OnTouchListener
在你的 onTouch(..)方法,你将简单地做一个 SoundPool.play(YOURAUDIOFILE,1,1,1,0,1);

Use a SoundPool combined with an OnTouchListener. In your onTouch(..) method you would simply do a SoundPool.play(YOURAUDIOFILE, 1, 1, 1, 0, 1);

胃肠HF

这篇关于播放上触碰的声音?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆