Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Boban Talevski24,793 Points
Help with the exercise mentioned near the end of the video about activity transitions in XML
Can we get a bit more help with the exercise mentioned near the end of the video (at about 4:30)?
Namely, we did set up the basics of Activity Transitions in the styles-v21 file by adding this item in the themes
So this means that all activities in the app will slide from the right, which is ok (5.0 or greater). But how do we add more specific details about the activity transitions in XML?
And what if we want to have different transitions for different activities. Do we create specific themes per activity with respective transitions and apply that theme to each activity in the manifest?
This seems to be an important topic as I don't see myself using activity transitions in code anytime soon (assuming we want our apps to be backwards compatible at least to 4.4 or so), so we should use the XML option more often I guess. Thus, we could use some basic pointers/examples or maybe even an additional video added in this course at the end of this section giving some basic examples about activity transitions in XML so we at least know where to start when delving deeper in the subject.
Ryan Jones1,378 Points
In themes in v21/styles.xml, I changed from slide_right to slide_bottom and set windowSharedElementsUseOverlay to false. This matches what Ben had done in Java code.
<item name="android:windowEnterTransition">@transition/slide_bottom</item> <item name="android:windowSharedElementsUseOverlay">false</item>
I added my own slide_bottom transition under the res/transition folder in v21/slide_bottom.xml. It specifically excludes the status bar from the transition animation, also to match what Ben had done in Java code:
<?xml version="1.0" encoding="utf-8"?> <slide xmlns:android="http://schemas.android.com/apk/res/android" android:slideEdge="bottom"> <targets> <target android:excludeId="@android:id/statusBarBackground" /> </targets> </slide>