
jskubick
Kotlin and Android Development featuring Jetpack: android:tint vs app:tint (chapter 7, p186)
I found an issue in Chapter 7 regarding android:backgroundTint vs app:backgroundTint.
How to replicate:
-
load chapter-7 from zipfile into Android Studio
-
view layout_coin_slot.xml
-
Notice that Android Studio is complaining about
android:tint="@color/coin_slot_color"
in the coin slot’s ImageView
Changing it to app:tint="@color/coin_slot_color"
fixes it.
The code in the zipfile is consistent with the code in the text… but both are actually wrong (at least, as far as ArcticFox in October 2021 is concerned) and the prefix has to be changed in order to successfully compile.
I think adding the dependency on com.google.android.material on p179 is what caused the use of android:tint to break in chapter 7 (because it worked just fine in chapter 6). I’m not 100% sure, but it looks like Google’s original implementation of the Material library had a bug, and they later decided to fix it in a way that caused any code that used the original syntax (with the ‘android’ prefix) to break.
Due to the namespace change for app:tint, the section about changing the other two Views becomes confusing.
The ImageView needs app:tint="@color/coin_slot_color"
, but the View needs android:backgroundTint="@color/coin_slot_color"
, and the TextView needs android:textColor="@color/coin_slot_color"
First Post!

mfazio23
Hey Jeff,
Which version of the the Material library are you using here?
Also, if the app:tint
version also works with older versions, I’ll just update it to use that instead.
Popular Pragmatic Bookshelf topics








Modern Front-End Development for Rails - application does not start after run bin/setup (page xviii)


Other popular topics









Categories:
Sub Categories:
Popular Portals
- /elixir
- /rust
- /wasm
- /ruby
- /erlang
- /phoenix
- /keyboards
- /rails
- /js
- /python
- /security
- /go
- /swift
- /vim
- /clojure
- /java
- /haskell
- /emacs
- /svelte
- /onivim
- /typescript
- /crystal
- /c-plus-plus
- /tailwind
- /kotlin
- /gleam
- /react
- /flutter
- /elm
- /ocaml
- /ash
- /vscode
- /opensuse
- /centos
- /php
- /deepseek
- /scala
- /zig
- /html
- /debian
- /nixos
- /lisp
- /agda
- /sublime-text
- /textmate
- /react-native
- /kubuntu
- /arch-linux
- /revery
- /ubuntu
- /manjaro
- /django
- /spring
- /diversity
- /nodejs
- /lua
- /c
- /slackware
- /julia
- /neovim