android - Negative margin bigger than view's height on pre lollipop devices -
it seems not possible assign negative value bigger view's dimensions. example, lets have following layout:
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:background="@color/colorprimary" android:layout_height="match_parent" android:orientation="vertical"> <relativelayout android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="56dp" android:background="@color/colorprimary" android:layout_margintop="-2dp"> <imageview android:id="@+id/closeiv" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centervertical="true" android:layout_margin="12dp" android:src="@drawable/ic_close_white_24dp" /> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centervertical="true" android:layout_torightof="@id/closeiv" android:text="galerÍa" android:textcolor="@color/white" android:textsize="17sp" android:textstyle="bold" /> <view android:layout_alignparentbottom="true" android:background="@android:color/black" android:layout_width="match_parent" android:layout_height="0.5dp"/> </relativelayout> <imageview android:id="@+id/pictureiv" android:scaletype="centercrop" android:layout_width="match_parent" android:layout_below="@+id/toolbar" android:layout_height="wrap_content"/> <android.support.v7.widget.recyclerview android:id="@+id/galleryrv" android:layout_below="@+id/pictureiv" android:background="@android:color/black" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignparentbottom="true" android:layout_margintop="2dp" android:textappearance="?android:attr/textappearancelarge"/> <view android:layout_below="@id/pictureiv" android:layout_width="match_parent" android:background="@drawable/grid_layout_separator" android:layout_height="10dp"/> </relativelayout>
if set top margin of toolbar bigger toolbar's height, let's -200dp, output in postlollipop devices toolbar hidden, 144dp of image view hidden , recyclerview stretched 200dp, can see similar behaviour on instagram's gallery. in pre lollipop devices output be, toolbar hidden, imageview on top , recyclerview stretched 56 dp. seems not possible set negative margin bigger toolbar's height, there workaround have similar behaviour in prelollipop devices?
Comments
Post a Comment