Chapter 9: android:textAppearance="?attr/textAppearanceHeadline5" is not working for me

Hello

In chapter 9 Im supposed to make a TextView with android:textAppearance=“?attr/textAppearanceHeadline5”
but the text is not big but very small.

I must say that I had to create the layout folder myself and that it didnt exist, so all it contains is fragment_crime_detail.xml

Also the EditText component doesnt look like a component where you can fill in something.

What can I do to fix that?

There could be a handful of things happening here, so hopefully I can narrow it down.

  • What class does your MainActivity class extend? It should be AppCompatActivity.
  • What theme is defined as the parent in your themes.xml file? It should be Theme.MaterialComponents.DayNight.DarkActionBar.

It was extending to ComponentActivity(), I replaced it with what you said now
and I added the theme it themes.xls
I synced gradle and got this when building

Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction
   > Android resource linking failed
     error: resource style/Theme.MaterialComponents.DayNight.DarkActionBar (aka com.bignerdranch.android.criminalintent:style/Theme.MaterialComponents.DayNight.DarkActionBar) not found.
     error: failed linking references.

Ok yup. It looks like you might have used a different project template than what we wanted when creating Criminal Intent. That is fine and you definitely do not have to start the project fresh. I think we can get things where they need to be by just adding these lines to your dependencies (similar to what you did for the ViewModel libraries and the Fragment library):

    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'com.google.android.material:material:1.10.0'

As a side note, you should use the new project “Empty Views Activity” template for every project in the book. In the past few months, Google changed the “Empty Activity” template to include Jetpack Compose and removed some stuff that our apps need. Feel free to use the “Empty Activity” template in projects once you are done reading the BNR book, but the BNR book assumes that you are using the “Empty Views Activity”. Sorry for the confusion.