In Android the visual design is stored in XML files and each Activity is associated to a design.
setContentView(R.layout.main)
R
means Resource
layout
means design
main
is the xml you have created under res->layout->main.xml
Whenever you want to change the current look of an Activity or when you move from one Activity to another, the new Activity must have a design to show. We call setContentView
in onCreate with the desired design as argument.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…