Lecture 5: Styles and Themes Flashcards

1
Q

What is the difference between styles and themes?

A

Style: XML objects designed to apply styling to a particular view

Theme: XML object designed to apply styling to the entire app or activity. Themes apply to all views within an app or activity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What type of file is the styles file and where is it stored?

A

XML

/res/values/styles.xml

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How can you apply a style to a view?

A

Set the parents view’s style property with @filename/stylename

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How can you apply a theme?

A

Once youve declared a style you can use it as a theme by modifying the app manifest and adding the android:theme property to the ‘application’ or ‘activity’ objects

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What property is used to define which style a style object inherits from?

A

parent

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How many style properties can a view have?

A

1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the work around for applying additional styling to a view?

A

Use a theme or inherit the style then modify it

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Overlapping style properties in a child will ____ the inherited style properties of the parent object

A

override

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the styling hierarchy?

A
  1. Applying character- or paragraph-level styling via text spans to TextView-derived classes
  2. Applying attributes programmatically
  3. Applying individual attributes directly to a View
  4. Applying a style to a View
  5. Default styling
  6. Applying a theme to a collection of Views, an activity, or your entire app
  7. Applying certain View-specific styling, such as setting a TextAppearance on a TextView
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What property is used to style text and what does it style?

A

TextApperance

Styles font size, color, etc

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the file used to store colors, what type of file is it, and where is it stored?

A

colors.xml

/res/values/

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How do you reference colors defined in the colors.xml?

A

@colors/colorPrimary

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What function can you use to programmatically set themes for activities?

A

setTheme() and recreate()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly