在我的应用程序中,我试图在布局中的所有视图上实现一个不可点击的包装器布局来禁用它们,就像我迄今为止的预览版本一样。
XML:更新
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_height="match_parent"
>
<ProgressBar
android:indeterminate="true"
android:theme="@style/CircularProgress"
android:id="@+id/car_progress"
style="?android:attr/progressBarStyle"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_centerInParent="true"
android:visibility="gone"
/>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/car_progress"
android:id="@+id/nested_scroll"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/mega_wrapper"
android:layout_alignParentStart="true">
<!-- all previewable views -->
<!-- Wrapper Layout with alpha background-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/alphaWhite"
android:clickable="false"
>
</LinearLayout>
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
</RelativeLayout>
但它不能正常工作。因为我无法在所有视图中看到alpha包装。
答案 0 :(得分:1)
像这样更改布局的顺序
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<ProgressBar
android:id="@+id/car_progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="?android:attr/progressBarStyle"
/>
<android.support.v4.widget.NestedScrollView
android:id="@+id/nested_scroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/car_progress"
>
<RelativeLayout
android:id="@+id/mega_wrapper"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<!-- all previewable views -->
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
<!-- Wrapper Layout with alpha background-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#33FF0000"
android:clickable="false"
/>
</RelativeLayout>