May 2022
Intermediate to advanced
688 pages
20h 12m
English
Before you start animating, you will want to inflate and bind your layout in MainActivity, in the onCreate(…) function.
Listing 25.5 Inflating and binding the layout (MainActivity.kt)
class MainActivity : AppCompatActivity() {
private lateinit var binding: ActivityMainBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)
}
}
Now, it is time to animate the sun down below the horizon. Here is the plan: Smoothly move binding.sun so that its top is right at the edge of the bottom of the sky. Since the bottom of the sky and the top of the sea ...
Read now
Unlock full access