I used the AppBarLayout inside the CoordinatorLayout , in my application. Due to certain design requirements, I was forced to remove the shadow below the AppBarLayout element by setting its elevation property to 0. ( app:elevation="0" ). After that, the elements inside the AppBarLayout, the tabs do not respond to touch / click events.
By setting the height back to 1dp, the elements respond to touch / click events, but then I go back to the shadow ...
Does anyone have a suggestion on how to get elements to respond to touch / click events, and AppBarLayout is at 0dp ?
Code output:
<android.support.design.widget.CoordinatorLayout android:id="@+id/rootLayout" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="@dimen/app_bar_height" app:elevation="0dp"> <android.support.v7.widget.Toolbar android:id="@+id/my_toolbar" android:layout_height="wrap_content" android:layout_width="match_parent" android:minHeight="?attr/actionBarSize"> <ImageView android:layout_width="wrap_content" android:layout_height="45dp" android:scaleType="fitCenter" android:layout_gravity="center" android:id="@+id/toolbar_logo" android:maxHeight="45dp" android:contentDescription="Main logo"/> </android.support.v7.widget.Toolbar> <android.support.design.widget.TabLayout android:layout_width="match_parent" android:layout_height="wrap_content" app:tabIndicatorColor="@color/tab_indicator_color" app:tabTextColor="@color/primary_text_grey" app:tabIndicatorHeight="3dp" android:id="@+id/tab_layout"> </android.support.design.widget.TabLayout> </android.support.design.widget.AppBarLayout>.......
source share