I am just starting out with material design and am faced with the challenge of getting elevated to work with anything but CardView. In particular, should it work with LinearLayout?
<LinearLayout
android:paddingTop="10dp"
android:orientation="vertical"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="2dp">
<LinearLayout
android:id="@+id/shareLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="10dp">
<ImageView
android:id="@+id/shareIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_share_black_48dp"/>
<TextView
android:id="@+id/shareText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingLeft="10dp"
android:text="@string/action_share"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_computer_black_48dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingLeft="10dp"
android:text="@string/action_desktop"/>
</LinearLayout>
</LinearLayout>
This code does not create a visible layout height - there is no shadow. If I put it in CardView, the height will work, but then I have problems with clicking events. I tried to delete the images, but this does not affect. Do I just need to wrap everything I want picked up in CardView, or is there another way? Thank.
I am testing a Nexus 7 running Android 5.0.2.
UPDATE
I tried the outline provider, as suggested, and this leads to a shadow, but weird.

It seems that LinearLayout is at an angle or something instead of just being raised. Changing the field does not help. Does anyone have any other ideas?