【问题标题】:How to get clickable status of imageButton on android如何在android上获取imageButton的可点击状态
【发布时间】:2015-01-09 07:50:13
【问题描述】:
btnCall.setClickable(false);    

我使用此代码进行设置,但我想得到它。

谁知道答案请建议我?

【问题讨论】:

  • 学习Accept Answers 如果答案没有帮助,那么就问题发表评论!如果有用,请接受我的回答..

标签: java android eclipse imagebutton clickable


【解决方案1】:

这里是如何获取ImageButton的可点击状态:

    ImageButton myButton = (ImageButton) findViewById(R.id.button1);
    myButton.setClickable(false);

    // if clickable is false
    if (myButton.isClickable() == false) {
        Log.i("MyButton", "Clickable is false");
        // do your things here
        ...
    }

    // if clickable is true
    if (myButton.isClickable() == true) {
        Log.i("MyButton", "Clickable is true");
        // do your things here
        ...
    }

【讨论】:

    【解决方案2】:

    这是针对安卓的,因为你在标题中提到了!

    如果您想知道ImageButton 是否可点击..

    boolean status = btnCall.isClickable(); // will return true if its clickable, false otherwise
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-07
      • 2014-08-18
      • 1970-01-01
      • 2011-06-17
      • 1970-01-01
      相关资源
      最近更新 更多