Recently I had to create a transparent activity with a toolbar where the user will type content to be queried. The rest of the activity should be transparent and allow user interactions. The I've found so for for doing that is:
getWindow().addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
As indicated in this question: link. I've also tried the solution
getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH,
WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH);
As said here: link
The problem with the first link is that the top activity (which contains the toolbar) no longer receives click events. The problem with the second one is that the bottom activity does not receives the click event. How can I make top activity receive click events and pass it to the bottom activity when click is made in the transparent activity?
This is my top activity layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:id="@+id/root_layout"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/white"
android:clickable="true"
android:elevation="2dp"
android:minHeight="?attr/actionBarSize"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="10dip"
android:backgroundTint="#FFF"
android:hint="@string/act_search_toolbar_hint"
android:textColor="#757575"
android:textColorHint="#757575"/>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
<View
android:layout_width="match_parent"
android:layout_height="5dp"
android:background="#FFF"/>
</LinearLayout>
How it looks like: