class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
HappyBirthdayTheme {
// A surface container using the 'background' color from the theme
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background
) {
}
}
}
}
}
Therefore although the code can work following the tutorial, it does not appear to work when you get to the steps about aligning the text with textAlign, which I assumed was due to it using Scaffold and not Surface.
Given my assumption and noticing the differences between my code and the tutorial, I fixed it by importing what I assumed was missing for example;
Then I tried to match the code to the the tutorial the best I could and got it working as expected, I assume there is missing code and or imports from the outdated/incorrect template?
Steps to reproduce?
In Android Studio
New Project
Phone and Tablet
Empty Activity
Versions
Android Studio Koala | 2024.1.1 Patch 1
Build #AI-241.18034.62.2411.12071903, built on July 10, 2024
Runtime version: 17.0.11+0-17.0.11b1207.24-11852314 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 6.1.52-valve16-1-neptune-61
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 8
Registry:
ide.experimental.ui=true
Current Desktop: KDE
Additional information
I did get my Android Studio from Flathub, and initially thought this may be why there was differences in the templates and the tutorial, but as you can see it is the latest version (I think?).
URL of codelab
Step Step 9.
Describe Issue The default template for "Empty Activity" on Android Studio (Versions and OS below) Appears to give Scaffold not Surface.
Example;
Where tutorial shows;
Therefore although the code can work following the tutorial, it does not appear to work when you get to the steps about aligning the text with
textAlign
, which I assumed was due to it usingScaffold
and notSurface
.Given my assumption and noticing the differences between my code and the tutorial, I fixed it by importing what I assumed was missing for example;
Then I tried to match the code to the the tutorial the best I could and got it working as expected, I assume there is missing code and or imports from the outdated/incorrect template?
Steps to reproduce? In Android Studio New Project Phone and Tablet Empty Activity
Versions
Additional information I did get my Android Studio from Flathub, and initially thought this may be why there was differences in the templates and the tutorial, but as you can see it is the latest version (I think?).