The Never-Ending Scroller

We want a background image to be displayed on the opening screen. It will pan slowly toward the upper-left corner of the display. No seams can be visible, and the animation has to be very smooth. The figure shows what it will look like.

Adding the View

To accomplish this we’re going to make a new type of view called ScrollingView and make it cover the entire screen behind the game selection menu. Edit res/layout/activity_main.xml and insert this block as the first child of the FrameLayout element:

ticTacToev5/src/main/res/layout/activity_main.xml
 
<org.example.tictactoe.ScrollingView
 
android:id=​"@+id/main_background"
 
android:layout_width=​"match_parent"
 
android:layout_height=​"match_parent"
 
app:scrollingDrawable=​ ...

Get Hello, Android, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.