Step 2: Add a background color for the buttons
In the layout, add a background color to each of the buttons. (You can either edit the XML in fragment_first.xml or use the Attributes panel, whichever you prefer.)
android:background="@color/buttonBackground"
It seems the button background gets set to:-
@color/purple_700
in themes.xml, and so the buttons stay purple, when your tutorial shows them changing to light blue.
Probably this tutorial was written before this theme was the default for this demo app.
The fix may be something like adding to themes.xml:-
Android Studio Bumblebee | 2021.1.1
Build #AI-211.7628.21.2111.8092744, built on January 19, 2022
Runtime version: 11.0.11+0-b60-7590822 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 12.1
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 16
Registry: external.system.auto.import.disabled=true, ide.instant.shutdown=false
Hi,
Great tutorial, so thanks for that.
One thing that doesn't work on Page 7 of the tutorial at:
https://developer.android.com/codelabs/build-your-first-android-app#6
is:-
Step 2: Add a background color for the buttons In the layout, add a background color to each of the buttons. (You can either edit the XML in fragment_first.xml or use the Attributes panel, whichever you prefer.)
android:background="@color/buttonBackground"
It seems the button background gets set to:-
in themes.xml, and so the buttons stay purple, when your tutorial shows them changing to light blue.
Probably this tutorial was written before this theme was the default for this demo app.
The fix may be something like adding to themes.xml:-
and in fragment_first.xml updating the theme id to that for all three buttons:-
Thanks
Steve
Version info:
Emulator: Pixel 2 API 30
Android Studio Bumblebee | 2021.1.1 Build #AI-211.7628.21.2111.8092744, built on January 19, 2022 Runtime version: 11.0.11+0-b60-7590822 x86_64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 12.1 GC: G1 Young Generation, G1 Old Generation Memory: 4096M Cores: 16 Registry: external.system.auto.import.disabled=true, ide.instant.shutdown=false