Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to disable background activity from transparent overlay fragment

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

like image 362
jil123 Avatar asked Dec 14 '22 11:12

jil123


1 Answers

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>
like image 189
Eoin Avatar answered Apr 29 '23 13:04

Eoin