android 禁用触摸屏,animation时禁用所有触摸屏交互
最后我作为@Matthieu的基本答案,让它以这样的方式工作。 我决定公布我的答案,因为我花了30分钟才能理解为什么会出错。XML.TouchBlackHoleView android:id="@+id/blackHole" android:layout_width="match_parent" android:layout_height="match_parent" />类公共类Touch
最后我作为@Matthieu的基本答案,让它以这样的方式工作。 我决定公布我的答案,因为我花了30分钟才能理解为什么会出错。
XML
.TouchBlackHoleView android:id="@+id/blackHole" android:layout_width="match_parent" android:layout_height="match_parent" />
类
公共类TouchBlackHoleView扩展了View {private boolean touchDisable = false;
public TouchBlackHoleView(Context context) { super(context); } public TouchBlackHoleView(Context context, AttributeSet attrs) { super(context, attrs); } public TouchBlackHoleView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } @Override public boolean onTouchEvent(MotionEvent event) { return touchDisable; } public void disableTouch(boolean value){ touchDisable = value; } }
运用
blackHole = (TouchBlackHoleView) findViewById(R.id.blackHole); blackHole.disableTouch(true);
请享用
更多推荐
所有评论(0)