O'Reilly logo

Hello, Android, 4th Edition by Ed Burnette

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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=​ ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required