android使用其他布局屏蔽布局
我正在应用程序中匹配的父布局中使用进度条。问题是,当进度条运行时,后台的按钮仍然可以单击。它们不应该是可点击的,那么如何使它们不可点击呢。布局如下:android使用其他布局屏蔽布局,android,progress-bar,clickable,Android,Progress Bar,Clickable,我正在应用程序中匹配的父布局中使用进度条。问题是,当进度条运行时,后台的按钮仍然可以单击。它们不应该是可点击的,那么如何使它们不可点击呢。布局如下: <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/black_with_fifty_percent_alpha" android:gr
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black_with_fifty_percent_alpha"
android:gravity="center"
android:orientation="vertical" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/white"
android:gravity="center_horizontal"
android:orientation="vertical" >
<ProgressBar
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/text_tv_progress_bar_bultenler"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
</LinearLayout>
尝试将此设置为此布局:
OnTouchListener listener = new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
return true;//consume the touch event
}
};
yourLayout.setOnTouchListener(listener);
setClickable(布尔值)不起作用?“setClickable”方法可能起作用,设置touch listener也是一个解决方案,但我不想要这些,我想知道在xml布局文件中是否有像“android:maskBackground”这样的简单解决方案。