I've tested this code on devices pre 5.0 and they all seem to work. When I try it on anything above 5.0 the images get clipped because their z position isn't at the front.
Here is the layout I'm trying to fix. The problem is the 5 images below the CardView. I want them to be somewhat "attatched" to the CardView" i.e the CardView has 5 images hanging off of it. They should be about 50% on the card and 50% off. I've achieved this with negative layout margin on android 4.4 and below but when I look at this on 5.0+ the images are underneath the CardView instead of on top of it.
I've tried to encase the CardView in a framelayout and do it that way but the views disappear entirely.
Any help would be greatly appreciated!
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clipChildren="false">
<android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/card_rep_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/rep_dean" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp">
<ImageView
android:id="@+id/card_image_type"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:background="@drawable/reps_small_image" />
<TextView
android:id="@+id/card_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/card_image_type"
android:textColor="@color/reps_icon" />
<TextView
android:id="@+id/card_rep_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/card_type"
android:layout_toRightOf="@id/card_image_type"
android:textColor="#333333"
android:textSize="15dp"
android:textStyle="bold" />
<LinearLayout
android:id="@+id/card_rep_bottom_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/card_rep_name"
android:layout_toRightOf="@id/card_image_type"
android:orientation="horizontal">
<ImageView
android:id="@+id/card_rep_office_identifier"
android:layout_width="10dp"
android:layout_height="10dp"
android:visibility="gone" />
<TextView
android:id="@+id/card_rep_office"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Space
android:layout_width="5dp"
android:layout_height="wrap_content" />
<View
android:layout_width="2dp"
android:layout_height="10dp"
android:layout_marginTop="7dp"
android:background="@android:color/darker_gray" />
<Space
android:layout_width="5dp"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/card_rep_location"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:layout_width="match_parent"
android:layout_height="30dp"
android:visibility="invisible" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
<ImageView
android:id="@+id/image_one"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentRight="true"
android:layout_below="@id/card_view"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="-25dp"
android:background="@drawable/social_bottom" />
<ImageView
android:id="@+id/image_two"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_below="@id/card_view"
android:layout_marginLeft="10dp"
android:layout_marginTop="-25dp"
android:layout_toLeftOf="@id/image_one"
android:background="@drawable/bills_bottom" />
<ImageView
android:id="@+id/image_three"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_below="@id/card_view"
android:layout_marginLeft="10dp"
android:layout_marginTop="-25dp"
android:layout_toLeftOf="@id/image_two"
android:background="@drawable/reps_gray_bottom" />
<ImageView
android:id="@+id/image_four"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_below="@id/card_view"
android:layout_marginLeft="10dp"
android:layout_marginTop="-25dp"
android:layout_toLeftOf="@id/image_three"
android:background="@drawable/polls_bottom" />
<ImageView
android:id="@+id/image_five"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_below="@id/card_view"
android:layout_marginTop="-25dp"
android:layout_toLeftOf="@id/image_four"
android:background="@drawable/news_bottom" />
</RelativeLayout>
</LinearLayout>