Bu dersimizde shared element animasyon çeşidini öğreniyoruz. Diğer örneklerden biraz farklı, bu yüzden ayrı sınıfta ve layoutta bu konuyu inceledik.
Bu konuda dikkat etmemiz gereken şey: shared element animasyonu uygulanacak view öğelerine transitionName özelliğini vermemiz…
Yine ilgili sınıfın onCreate methoduna getWindow().requestFeature(Windowç.FEATURE_CONTENT_TRANSITIONS) yazıyoruz.
case R.id.shared_element_layout:
Pair[] pairs=new Pair[2];
pairs[0]=new Pair<View, String>(imgStar, “star”);
pairs[1]=new Pair<View, String>(tvSharedElement, “text_view”);
ActivityOptions options=ActivityOptions.makeSceneTransitionAnimation(this, pairs);
Intent intent=new Intent(this, ActivitySharedElement.class);
startActivity(intent, options.toBundle());
break;
yazıyoruz. Burda iki tane efekt uygulanacak view öğemiz olduğundan Pair sınıfını kullanıyoruz. İkinci parametre olarak transitionName olarak verdiğimiz değeri geçiyoruz.
Bir transition efektini xml ile gerçekleştirmek istiyorsak eğer res klasörü altına transition adında bir klasör oluşturmamız gerekiyor. Daha sonra bir transition nesnesi yaratıp buna TransitionInflater.from(this). inflateTransition(R.transition.explode) diyerek ilgili dosyayı atıyoruz. Daha sonra getWindow().setEnterTransition diyip efekti uyguluyoruz.
Bu uygulamanın tüm kodları aşağıdaki gibidir, tüm projeyi INDIRMEK ICIN TIKLAYIN….
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
package com.example.emrealtunbilek.materialanimation; import android.app.ActivityOptions; import android.content.Intent; import android.os.Build; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.transition.Slide; import android.util.Pair; import android.view.Gravity; import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; public class MainActivity extends AppCompatActivity implements View.OnClickListener { TextView tvRippleWithBorder, tvRippleWithoutBorder, tvCustomRippleWithBorder, tvCustomRippleWithoutBorder; Button btnExplodeJava, btnExplodeXML; Button btnSlideJava, btnSlideXML; Button btnFadeJava, btnFadeXML; LinearLayout linearLayout; ImageView imgStar; TextView tvSharedElement; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ilkleme(); Slide slide=new Slide(); slide.setSlideEdge(Gravity.LEFT); slide.setDuration(1000); Slide slide2=new Slide(); slide2.setSlideEdge(Gravity.RIGHT); slide2.setDuration(1000); getWindow().setReenterTransition(slide); getWindow().setAllowReturnTransitionOverlap(false); getWindow().setExitTransition(slide2); } public void ilkleme() { tvRippleWithBorder = (TextView) findViewById(R.id.tvRippleEffectwithBorder); tvRippleWithoutBorder = (TextView) findViewById(R.id.tvRippleEffectwithoutBorder); tvCustomRippleWithBorder = (TextView) findViewById(R.id.tvCustomRippleWithBorder); tvCustomRippleWithoutBorder = (TextView) findViewById(R.id.tvCustomRippleWithoutBorder); btnExplodeJava = (Button) findViewById(R.id.btnExplodeJava); btnExplodeXML = (Button) findViewById(R.id.btnExplodeXML); btnSlideJava = (Button) findViewById(R.id.btnSlideJava); btnSlideXML = (Button) findViewById(R.id.btnSlideXML); btnFadeJava = (Button) findViewById(R.id.btnFadeJava); btnFadeXML = (Button) findViewById(R.id.btnFadeXML); linearLayout= (LinearLayout) findViewById(R.id.shared_element_layout); imgStar= (ImageView) findViewById(R.id.ivStar); tvSharedElement= (TextView) findViewById(R.id.tvSharedElement); tvRippleWithBorder.setOnClickListener(this); tvRippleWithoutBorder.setOnClickListener(this); tvCustomRippleWithBorder.setOnClickListener(this); tvCustomRippleWithoutBorder.setOnClickListener(this); btnExplodeJava.setOnClickListener(this); btnExplodeXML.setOnClickListener(this); btnSlideJava.setOnClickListener(this); btnSlideXML.setOnClickListener(this); btnFadeJava.setOnClickListener(this); btnFadeXML.setOnClickListener(this); linearLayout.setOnClickListener(this); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.btnExplodeJava: if (Build.VERSION.SDK_INT >= 21) { ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(this); Intent intent = new Intent(this, Activity2.class); intent.putExtra("TUR", "EXPLODEJAVA"); intent.putExtra("BASLIK", "EXPLODE ANIMASYON"); intent.putExtra("AD", "Java ile Explode"); startActivity(intent, options.toBundle()); } else { Intent intent = new Intent(this, Activity2.class); startActivity(intent); } break; case R.id.btnExplodeXML: if (Build.VERSION.SDK_INT >= 21) { ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(this); Intent intent = new Intent(this, Activity2.class); intent.putExtra("TUR", "EXPLODEXML"); intent.putExtra("BASLIK", "EXPLODE ANIMASYON"); intent.putExtra("AD", "XML ile Explode"); startActivity(intent, options.toBundle()); } else { Intent intent = new Intent(this, Activity2.class); startActivity(intent); } break; case R.id.btnSlideJava: if (Build.VERSION.SDK_INT >= 21) { ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(this); Intent intent = new Intent(this, Activity2.class); intent.putExtra("TUR", "SLIDEJAVA"); intent.putExtra("BASLIK", "SLIDE ANIMASYON"); intent.putExtra("AD", "Java ile Slide"); startActivity(intent, options.toBundle()); } else { Intent intent = new Intent(this, Activity2.class); startActivity(intent); } break; case R.id.btnSlideXML: if (Build.VERSION.SDK_INT >= 21) { ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(this); Intent intent = new Intent(this, Activity2.class); intent.putExtra("TUR", "SLIDEXML"); intent.putExtra("BASLIK", "SLIDE ANIMASYON"); intent.putExtra("AD", "XML ile Slide"); startActivity(intent, options.toBundle()); } else { Intent intent = new Intent(this, Activity2.class); startActivity(intent); } break; case R.id.btnFadeJava: if (Build.VERSION.SDK_INT >= 21) { ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(this); Intent intent = new Intent(this, Activity2.class); intent.putExtra("TUR", "FADEJAVA"); intent.putExtra("BASLIK", "FADE ANIMASYON"); intent.putExtra("AD", "Java ile Fade"); startActivity(intent, options.toBundle()); } else { Intent intent = new Intent(this, Activity2.class); startActivity(intent); } break; case R.id.btnFadeXML: if (Build.VERSION.SDK_INT >= 21) { ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(this); Intent intent = new Intent(this, Activity2.class); intent.putExtra("TUR", "FADEXML"); intent.putExtra("BASLIK", "FADE ANIMASYON"); intent.putExtra("AD", "XML ile Fade"); startActivity(intent, options.toBundle()); } else { Intent intent = new Intent(this, Activity2.class); startActivity(intent); } break; case R.id.shared_element_layout: Pair[] pairs=new Pair[2]; pairs[0]=new Pair<View, String>(imgStar, "star"); pairs[1]=new Pair<View, String>(tvSharedElement, "text_view"); ActivityOptions options=ActivityOptions.makeSceneTransitionAnimation(this, pairs); Intent intent=new Intent(this, ActivitySharedElement.class); startActivity(intent, options.toBundle()); break; } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginBottom="10dp" android:layout_marginLeft="10dp" android:layout_marginTop="10dp" tools:context="com.example.emrealtunbilek.materialanimation.MainActivity"> <TextView android:text="Ripple Effect with Border" android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/tvRippleEffectwithBorder" android:background="?android:attr/selectableItemBackground" android:layout_marginBottom="10dp" android:textSize="22sp" /> <TextView android:text="Ripple Effect without Border" android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/tvRippleEffectwithoutBorder" android:background="?android:attr/selectableItemBackgroundBorderless" android:layout_marginBottom="10dp" android:textSize="22sp" /> <TextView android:text="Custom Ripple with Border" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:textSize="22sp" android:background="@drawable/ripple_with_border" android:id="@+id/tvCustomRippleWithBorder" /> <TextView android:text="Custom ripple without Border" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:textSize="22sp" android:background="@drawable/ripple_without_border" android:id="@+id/tvCustomRippleWithoutBorder" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="EXPLODE JAVA" android:layout_weight="1" android:id="@+id/btnExplodeJava" android:layout_marginRight="10dp" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="EXPLODE XML" android:layout_marginRight="10dp" android:id="@+id/btnExplodeXML" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="SLIDE JAVA" android:layout_weight="1" android:id="@+id/btnSlideJava" android:layout_marginRight="10dp" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="SLIDE XML" android:layout_marginRight="10dp" android:id="@+id/btnSlideXML" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="FADE JAVA" android:layout_weight="1" android:id="@+id/btnFadeJava" android:layout_marginRight="10dp" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="Fade XML" android:layout_marginRight="10dp" android:id="@+id/btnFadeXML" /> </LinearLayout> </LinearLayout> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginBottom="10dp" android:layout_marginLeft="10dp" android:layout_marginTop="10dp" tools:context="com.example.emrealtunbilek.materialanimation.MainActivity"> <TextView android:text="Ripple Effect with Border" android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/tvRippleEffectwithBorder" android:background="?android:attr/selectableItemBackground" android:layout_marginBottom="10dp" android:textSize="22sp" /> <TextView android:text="Ripple Effect without Border" android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/tvRippleEffectwithoutBorder" android:background="?android:attr/selectableItemBackgroundBorderless" android:layout_marginBottom="10dp" android:textSize="22sp" /> <TextView android:text="Custom Ripple with Border" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:textSize="22sp" android:background="@drawable/ripple_with_border" android:id="@+id/tvCustomRippleWithBorder" /> <TextView android:text="Custom ripple without Border" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:textSize="22sp" android:background="@drawable/ripple_without_border" android:id="@+id/tvCustomRippleWithoutBorder" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="EXPLODE JAVA" android:layout_weight="1" android:id="@+id/btnExplodeJava" android:layout_marginRight="10dp" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="EXPLODE XML" android:layout_marginRight="10dp" android:id="@+id/btnExplodeXML" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="SLIDE JAVA" android:layout_weight="1" android:id="@+id/btnSlideJava" android:layout_marginRight="10dp" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="SLIDE XML" android:layout_marginRight="10dp" android:id="@+id/btnSlideXML" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="FADE JAVA" android:layout_weight="1" android:id="@+id/btnFadeJava" android:layout_marginRight="10dp" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="Fade XML" android:layout_marginRight="10dp" android:id="@+id/btnFadeXML" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_margin="20dp" android:gravity="center" android:id="@+id/shared_element_layout"> <ImageView android:layout_width="50dp" android:layout_height="50dp" android:layout_gravity="center" android:layout_margin="10dp" android:id="@+id/ivStar" android:tint="@android:color/holo_blue_dark" android:src="@drawable/star"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="30sp" android:id="@+id/tvSharedElement" android:text="Shared Element"/> </LinearLayout> </LinearLayout> |
1 2 3 4 5 6 7 |
<?xml version="1.0" encoding="utf-8"?> <ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="@android:color/holo_orange_dark"> <item android:id="@android:id/mask" android:drawable="@android:color/white"/> </ripple> |
1 2 3 4 5 6 |
<?xml version="1.0" encoding="utf-8"?> <ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="@android:color/holo_orange_dark"> </ripple> |
1 2 3 4 5 6 7 8 9 10 11 12 |
<?xml version="1.0" encoding="utf-8"?> <transitionSet xmlns:android="http://schemas.android.com/apk/res/android"> <slide android:duration="1000" android:slideEdge="bottom" > </slide> </transitionSet> |
1 2 3 4 5 6 7 8 9 |
<?xml version="1.0" encoding="utf-8"?> <transitionSet xmlns:android="http://schemas.android.com/apk/res/android"> <fade android:duration="2000" android:fadingMode="fade_out" ></fade> </transitionSet> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
public class Activity2 extends AppCompatActivity { String tur, baslik, ad; Button btnCikis; TextView tvAnimasyonAdi; @Override protected void onCreate(Bundle savedInstanceState) { getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); super.onCreate(savedInstanceState); setContentView(R.layout.activity_2); ilkleme(); tur=getIntent().getStringExtra("TUR"); baslik=getIntent().getStringExtra("BASLIK"); ad=getIntent().getStringExtra("AD"); getSupportActionBar().setTitle(baslik); getSupportActionBar().setDisplayHomeAsUpEnabled(true); tvAnimasyonAdi.setText(ad); animasyonUygula(); getWindow().setAllowEnterTransitionOverlap(false); } private void animasyonUygula() { switch (tur){ case "EXPLODEJAVA": if(Build.VERSION.SDK_INT>=21) { Explode enterTransition = new Explode(); enterTransition.setDuration(1500); getWindow().setEnterTransition(enterTransition); } break; case "EXPLODEXML": if(Build.VERSION.SDK_INT>=21) { Transition enterTransition = TransitionInflater.from(this).inflateTransition(R.transition.explode); getWindow().setEnterTransition(enterTransition); } break; case "SLIDEJAVA": if(Build.VERSION.SDK_INT>=21) { Slide enterTransition=new Slide(); enterTransition.setDuration(1500); enterTransition.setSlideEdge(Gravity.LEFT); getWindow().setEnterTransition(enterTransition); } break; case "SLIDEXML": if(Build.VERSION.SDK_INT>=21) { Transition enterTransition = TransitionInflater.from(this).inflateTransition(R.transition.slide); getWindow().setEnterTransition(enterTransition); } break; case "FADEJAVA": if(Build.VERSION.SDK_INT>=21) { Fade enterTransition=new Fade(); enterTransition.setDuration(5500); enterTransition.setInterpolator(new OvershootInterpolator()); getWindow().setEnterTransition(enterTransition); } break; case "FADEXML": if(Build.VERSION.SDK_INT>=21) { Transition enterTransition = TransitionInflater.from(this).inflateTransition(R.transition.fade); getWindow().setEnterTransition(enterTransition); } break; } } private void ilkleme() { btnCikis= (Button) findViewById(R.id.btnCikis); tvAnimasyonAdi= (TextView) findViewById(R.id.tvAnimasyonAdi); btnCikis.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); } @Override public boolean onSupportNavigateUp() { if(Build.VERSION.SDK_INT>=21) { finishAfterTransition(); } else { finish(); } return true; } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:fitsSystemWindows="true" android:gravity="center" tools:context="com.example.emrealtunbilek.materialanimation.Activity2"> <ImageView android:layout_width="200dp" android:layout_height="200dp" app:srcCompat="@drawable/star" android:id="@+id/imageView" android:tint="@color/colorAccent" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="20dp" android:text="Animasyon Adı" android:textSize="20sp" android:id="@+id/tvAnimasyonAdi" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="10dp" android:gravity="center" android:text="Emre Altunbilek Eğitim Platformun www.emrealtunbilek.com" /> <Button android:text="ÇIKIŞ" android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/btnCikis" /> </LinearLayout> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:fitsSystemWindows="true" android:gravity="center" tools:context="com.example.emrealtunbilek.materialanimation.Activity2"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="20dp" android:text="Shared Element" android:textSize="20sp" android:transitionName="text_view" android:id="@+id/tvAnimasyonAdi"/> <ImageView android:layout_width="200dp" android:layout_height="200dp" app:srcCompat="@drawable/star" android:id="@+id/imageView" android:transitionName="star" android:tint="@android:color/holo_blue_dark" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="10dp" android:gravity="center" android:text="Emre Altunbilek Eğitim Platformun www.emrealtunbilek.com" /> <Button android:text="ÇIKIŞ" android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/btnCikis" /> </LinearLayout> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
public class ActivitySharedElement extends AppCompatActivity { Button btnCikis; @Override public void onCreate(Bundle savedInstanceState) { getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS); super.onCreate(savedInstanceState); setContentView(R.layout.activity_shared_element); btnCikis= (Button) findViewById(R.id.btnCikis); getSupportActionBar().setTitle("Shared Element"); getSupportActionBar().setDisplayHomeAsUpEnabled(true); btnCikis.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); } @Override public boolean onSupportNavigateUp() { finishAfterTransition(); return true; } } |