android 5.0+ negative layout margins don't seem to work -
i've tested code on devices pre 5.0 , seem work. when try on above 5.0 images clipped because z position isn't @ front.
here layout i'm trying fix. problem 5 images below cardview. want them "attatched" cardview" i.e cardview has 5 images hanging off of it. should 50% on card , 50% off. i've achieved negative layout margin on android 4.4 , below when @ on 5.0+ images underneath cardview instead of on top of it.
i've tried encase cardview in framelayout , way views disappear entirely.
any 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>
consider this
<android.support.v7.widget.cardview xmlns:card_view="http://schemas.android.com/apk/res-auto" android:id="@+id/card_view" android:layout_marginbottom="13dp" android:layout_width="match_parent" android:layout_height="wrap_content"
and imageviews
:
<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" />
Comments
Post a Comment