本文介绍了我怎样才能保持一个按钮的点击后pssed $ P $?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可能重复:
<一href="http://stackoverflow.com/questions/4674940/android-how-do-i-keep-a-button-displayed-as-$p$pssed-until-the-action-created-by">Android.如何保持显示为preSSED一个按钮,直到由按钮创建的动作完成?
我有一个按钮,我想,当我pressed它留为(在升级Froyo与绿色)pssed $ P $ ..任何帮助??
I have one button and i want when i pressed it to stay as pressed (with the green color at froyo)..Any help??
mycodes_Button = (Button) findViewById(R.id.mycodes);
...
if (saved_Button.isPressed())
{
saved_Button.setFocusable(true);
}
这样的事情?
Something like this?
推荐答案
嗨使用下面的code就会有用,
Hi use the following code it will usefull,
mycodes_Button.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
mycodes_Button.setPressed(true);
return true;
}
});
这篇关于我怎样才能保持一个按钮的点击后pssed $ P $?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!