Android material design "hero" transition with scrollview -
im trying decent looking material design animation shown here: https://developer.android.com/training/material/animations.html
i've set recyclerview
, populated items created detailactivity. explained here: https://stackoverflow.com/a/26666067/2326538 pass both cardview
layout , imageview
shared elements transition, not working:
intent intent = new intent(activity, newsdetailactivity.class); intent.putextra(extra_param_id, (int) id); activityoptionscompat options = activityoptionscompat.makescenetransitionanimation(activity, pair.create(contentview, "contentview"), pair.create(sharedview, "imageview") ); activity.startactivityforresult(intent, request_code, options.tobundle());
it flickers , seems views other imageview
slide top , cover navigation bar.
here's layout file list item:
<?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.cardview xmlns:android="http://schemas.android.com/apk/res/android" xmlns:card_view="http://schemas.android.com/apk/res-auto" android:id="@+id/news_list_item_cv" android:layout_width="match_parent" android:layout_height="365dp" android:layout_margin="5dp" android:foreground="?attr/selectableitembackground" card_view:cardusecompatpadding="true" card_view:cardelevation="1.5dp" card_view:cardcornerradius="2dp"> <linearlayout android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:cliptopadding="false"> <com.android.volley.toolbox.networkimageview android:id="@+id/news_list_item_image" android:layout_width="match_parent" android:layout_height="178dp" android:scaletype="centercrop" /> <linearlayout android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:padding="16dp"> <textview android:id="@+id/news_list_item_title" android:layout_width="match_parent" android:layout_height="wrap_content" android:ellipsize="end" android:singleline="false" android:maxlines="2" android:textcolor="@color/primarytext" android:textsize="18sp" android:textstyle="normal" /> <textview android:id="@+id/news_list_item_subtitle" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margintop="16dp" android:ellipsize="end" android:singleline="false" android:maxlines="3" android:textcolor="@color/secondarytext" android:textsize="14sp" android:textstyle="normal"/> </linearlayout> </linearlayout> </android.support.v7.widget.cardview>
and here's detailactivity:
<framelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/news_detail_root" android:layout_width="match_parent" android:layout_height="match_parent"> <com.github.ksoichiro.android.observablescrollview.observablescrollview android:id="@+id/news_detail_scrollview" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingtop="@dimen/flexible_space_image_height" android:cliptopadding="false"> <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="top" android:orientation="vertical" android:paddingtop="@dimen/activity_vertical_margin" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:background="@android:color/white"> <textview android:id="@+id/news_detail_image_desc_textview" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginbottom="@dimen/activity_vertical_margin" android:textappearance="@style/textappearance.appcompat.small"/> <textview android:id="@+id/news_detail_title_textview" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginbottom="@dimen/activity_vertical_margin" android:textappearance="@style/textappearance.appcompat.large"/> <textview android:id="@+id/news_detail_article_textview" android:layout_width="match_parent" android:layout_height="wrap_content" android:textappearance="@style/base.textappearance.appcompat.body1" android:textisselectable="true" /> </linearlayout> </com.github.ksoichiro.android.observablescrollview.observablescrollview> <!-- declare header layout --> <framelayout android:id="@+id/news_header" android:layout_width="match_parent" android:layout_height="wrap_content"> <relativelayout android:layout_width="match_parent" android:layout_height="@dimen/flexible_space_image_height" android:layout_marginbottom="36dp" android:background="@android:color/white" android:elevation="4dp"> <de.tobiaserthal.akgbensheim.ui.widget.backdropnetworkimageview android:id="@+id/news_header_imageview" android:layout_width="match_parent" android:layout_height="match_parent" android:scaletype="centercrop"/> <textview android:id="@+id/news_header_title" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_above="@+id/news_header_subtitle" android:layout_marginleft="16dp" android:layout_marginstart="16dp" android:gravity="center_vertical" android:textappearance="@style/textappearance.appcompat.title.inverse" android:text="@string/title_activity_news_detail"/> <textview android:id="@+id/news_header_subtitle" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignparentbottom="true" android:layout_marginbottom="6dp" android:layout_marginleft="16dp" android:layout_marginstart="16dp" android:layout_marginright="128dp" android:layout_marginend="128dp" android:gravity="center_vertical" android:singleline="true" android:ellipsize="end" android:textappearance="@style/textappearance.appcompat.subhead.inverse"/> </relativelayout> <!-- declare floating action button --> <com.melnykov.fab.floatingactionbutton android:id="@+id/news_detail_action_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|end" android:layout_margin="12dp" android:scaletype="centerinside" android:src="@drawable/abc_ic_menu_share_mtrl_alpha" app:fab_colornormal="?attr/coloraccent" app:fab_colorripple="@color/ripple_material_dark"/> </framelayout> <android.support.v7.widget.toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" android:background="@android:color/transparent" android:elevation="5dp" android:theme="@style/widget.apptheme.toolbar" app:popuptheme="@style/themeoverlay.appcompat.light" /> </framelayout>
Comments
Post a Comment