我遇到了一些實現自定義進度對話框的困難。即使疊加層截取觸摸事件,用戶仍然可以操作軌跡球並單擊應該禁用的元素。在Android中禁用軌跡球點擊
有沒有辦法解決這個問題?
編輯:這裏是一個解決方案
//=====================================================================================
protected void showProgressIndicator()
{
progressIndicator_.show();
}
//=====================================================================================
@Override
public boolean onTrackballEvent(MotionEvent event)
{
return progressIndicator_.getVisibility() == View.VISIBLE;
}
//=====================================================================================
protected void hideProgressIndicator()
{
progressIndicator_.hide();
}
的再show方法
//=====================================================================================
public void show()
{
setVisibility(VISIBLE);
if (animationHandler_ != null)
return;
animationHandler_ = new Handler();
animationHandler_.post(animateTask_);
requestFocus();
}
您的解決方案並不完全正確,因爲用戶無法以跟蹤球的方式導航,但他可以點擊它。所以如果一個按鈕集中,他仍然可以點擊它。解決方案只是從進度對話框中請求foucs並執行nTrackballEvent()。感謝您的諮詢:) – 2010-08-06 16:17:07
可以請你發佈解決方案? – Pria 2010-08-27 06:14:45
你有可能發佈通用代碼嗎? – 2011-02-08 14:24:38