I have a LinearLayout as a container in which I added views programatically. I tried to set elevation to the container. It's not working.Please refer to the layout below.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="5dp"
android:clipToPadding="false">
<LinearLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="#00FFFFFF"
android:orientation="vertical"
android:elevation="@dimen/cardview_default_elevation">
</LinearLayout>
//Other layouts ...
</LinearLayout>
I've also tried to set the elevation to the view to be added without setting elevation to container from xml.
View view = // get some view here
view.setPadding(0, 0, 0, Utils.dpToPx(10));
view.setElevation(2.0f);
container.addView(view);
It's also not working. Can someone help me out ?? Thanks!!