概述
import android.app.Activity;
import android.app.AlertDialog;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.ImageButton;
import android.media.MediaPlayer;
import android.media.MediaPlayer.OnCompletionListener;
public class hipsterdoofus extends Activity
{
private int asoundfilenumber;//integer id of sound file to be played
public ImageButton buttonOne;
public ImageButton buttonTwo;
public ImageButton buttonThree;
public ImageButton buttonFour;
public void myClickHandler(View v) {
switch (v.getId())
{
case R.id.buttonOne:
asoundfilenumber=0x7f040000;
break;
case R.id.buttonTwo:
asoundfilenumber=0x7f040001;
break;
case R.id.buttonThree:
asoundfilenumber=0x7f040002;
break;
case R.id.buttonFour:
asoundfilenumber=0x7f040003;
break;
}//closes switch test
freezeButtonsAndPlaySoundThenUnfreezeButtons();
}//closes onClick
public void freezeButtonsAndPlaySoundThenUnfreezeButtons()
{
**//buttonOne.setClickable( false );//sets buttonOne to unclickable**
MediaPlayer mp = MediaPlayer.create(getBaseContext(), asoundfilenumber);
mp.start();
mp.setOnCompletionListener(new OnCompletionListener()//listens for player to finish then releases player
{
@Override
public void onCompletion(MediaPlayer mpalmost)
{
mpalmost.release();
}
});
**//buttonOne.setClickable( true ); //sets buttonOne to clickable**
}
public void onCreate(Bundle savedInstanceState) {
super.onCreate( savedInstanceState );
setContentView( R.layout.main );
}
最后
以上就是甜美方盒为你收集整理的android 不可点击通知,Android系统。如何使用setClickable同时设置所有按钮可点击或不可点击?...的全部内容,希望文章能够帮你解决android 不可点击通知,Android系统。如何使用setClickable同时设置所有按钮可点击或不可点击?...所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复