Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Preview
Start a free Courses trial
to watch this video
Styles are great, but do we have to manually apply them to each child in a layout? Of course not! We can use Themes. In this video, we introduce you to themes, briefly discuss the troubled times of old when styling your Android applications on older versions of the platform, and ease your worry by letting you know that AppCompat has your back.
Although styles are great for
0:00
applying certain attributes to individual
views, what if we wanna think bigger and
0:01
apply certain characteristics to
entire parts of our application?
0:06
Do we have to manually create a style for
each view and apply it one by one?
0:09
That certainly seems like
a very tedious process, and
0:13
that's exactly why Android
has a concept of themes.
0:15
Themes are applied globally, either to the
entire application to certain activities
0:18
and now, with the release of Android
Lollipop 5.0, can be applied to Views.
0:23
In this course our app only requires
a very simple theme globally, and
0:28
one that's just ever slightly more
complex for the settings activity.
0:32
So we'll go ahead and
create that in the next video.
0:35
Although simple, themes in Android
are incredibly powerful and
0:37
you'll see just how useful they
are when we can do in two lines of
0:40
code what would normally have taken us
as many lines as Views in our layouts.
0:43
If you're fairly new to Android you might
not have experienced the mess that theming
0:47
your application used to be.
0:51
Due to the varied nature of Android, and
0:52
the fact that some users are still on much
older versions, we had to back port or
0:54
create different versions of your styles
that would work on different versions
0:58
of Android, depending on how far
back you want it to support.
1:01
Now Android comes with a really
cool library called AppCompat, so
1:05
we don't have to worry about
most of that hard work.
1:08
We're going to use AppCompat soon, but
1:11
first, I wanna take advantage
of the power of themes.
1:13
In the next video we're going to
write four lines of code to style
1:16
the entire settings activity
just the way we like.
1:19
After that we'll provide motivation for
why we wanna use
1:21
the backwards compatible themes and
show you how to make one yourself.
1:24
You need to sign up for Treehouse in order to download course files.
Sign up