本文整理了Java中android.widget.Button.setPressed()
方法的一些代码示例,展示了Button.setPressed()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Button.setPressed()
方法的具体详情如下:
包路径:android.widget.Button
类名称:Button
方法名:setPressed
暂无
代码示例来源:origin: stackoverflow.com
@Override
public void onStart(){
super.onStart();
Button button = (Button) findViewById(R.id.test_button);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Log.i(TAG, "Clicked");
}
});
// This will NOT trigger the onClickListener!
button.setPressed(true);
}
代码示例来源:origin: HelloChenJinJun/TestChat
@Override
public void onRecordTimeChange(int time, String localVoicePath) {
if (time > VoiceRecordManager.MAX_RECORD_TIME) {
time = VoiceRecordManager.MAX_RECORD_TIME;
// 这里做一个机制,防止错误重复发多次语音
speak.setPressed(false);
speak.setClickable(false);
sendVoiceMessage(localVoicePath, time);
handler.postDelayed(new Runnable() {
@Override
public void run() {
speak.setClickable(true);
}
}, 1000);
}
}
});
代码示例来源:origin: AndBible/and-bible
@Override
public boolean onTouchEvent(MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN :
case MotionEvent.ACTION_MOVE :
ButtonInfo but = findButton((int)event.getX(), (int)event.getY());
if (but!=null) {
// show the button being pressed
if (!but.equals(mPressed)) {
if (mPressed!=null) {
mPressed.button.setPressed(false);
}
but.button.setPressed(true);
mPressed = but;
showPreview(but);
}
}
break;
case MotionEvent.ACTION_UP :
if (mPressed!=null) {
buttonSelected(mPressed);
}
break;
}
return true; //super.onInterceptTouchEvent(ev);
}
代码示例来源:origin: bodismile/bmob-newim-demo
@Override
public void onTimeChanged(int recordTime, String localPath) {
Logger.i("voice", "已录音长度:" + recordTime);
if (recordTime >= BmobRecordManager.MAX_RECORD_TIME) {// 1分钟结束,发送消息
// 需要重置按钮
btn_speak.setPressed(false);
btn_speak.setClickable(false);
// 取消录音框
layout_record.setVisibility(View.INVISIBLE);
// 发送语音消息
sendVoiceMessage(localPath, recordTime);
//是为了防止过了录音时间后,会多发一条语音出去的情况。
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
btn_speak.setClickable(true);
}
}, 1000);
}
}
});
代码示例来源:origin: com.albedinsky.android/ui
/**
*/
@Override
public void setPressed(boolean pressed) {
final boolean isPressed = isPressed();
super.setPressed(pressed);
if (!isPressed && pressed) onPressed();
else if (isPressed) onReleased();
}
代码示例来源:origin: com.albedinsky.android/ui-widget-common
/**
*/
@Override
public void setPressed(boolean pressed) {
final boolean isPressed = isPressed();
super.setPressed(pressed);
if (!isPressed && pressed) onPressed();
else if (isPressed) onReleased();
}
代码示例来源:origin: HelloChenJinJun/TestChat
return false;
speak.setPressed(true);
record_container.setVisibility(View.VISIBLE);
record_tip.setText(R.string.chat_middle_voice_tip);
speak.setPressed(false);
record_container.setVisibility(View.INVISIBLE);
if (event.getY() < 0) {
内容来源于网络,如有侵权,请联系作者删除!