I have created transparent fragment overlay tutorial on activity and I want to disable touch event of background activity shown below transparent fragment. so user can not touch anything from activity and just use fragment help tutorial.
Thank you in advance
If you are using an fragment over an activity that is set to full screen ie match_parent
. Then in the fragments root layout you can set an attribute android:clickable="true"
to consume click events. By default layouts such as RelativeLayout , LinearLayout etc don't consume click events. Other views such as Button and TextView have this on by default.
In your overlay fragment.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true">
</RelativeLayout>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With