Search code examples
androidandroid-studiotabletandroid-5.0-lollipop

Material design on tablets Pre-Lollipop


I'm actually on Android Studio 1.0.2. I'm trying implement Material design on tablets with 4.1.2 Android version

I want do that: tabletsToolbar

okay, I'm reading the nexts blogs:

Problems:

I have on values/themes.xml the next code:

<style name="Theme.MyTheme" parent="Theme.AppCompat.Light">
    <!-- Here we setting appcompat’s actionBarStyle -->
    <item name="actionBarStyle">@style/MyActionBarStyle</item>

    <!-- ...and here we setting appcompat’s color theming attrs -->
    <item name="colorPrimary">@color/my_awesome_red</item>
    <item name="colorPrimaryDark">@color/my_awesome_darker_red</item>

    <!-- The rest of your attributes -->
</style>

It report an error like that:

error on android

(first problem) What is the problem?

(Second problem) How can implement Material design on pre-lollipop tablets? How can I do a similar design? (First blue toolbar and inside content with another toolbar)

Really, I've tried before asking...

Thanks


Solution

  • First Problem: It looks like your themes.xml file isn't properly written. Your top level element should be <resources>. Try instead...

    <resources>
        <style name="Theme.MyTheme" parent="Theme.AppCompat.Light">
            <!-- Here we setting appcompat’s actionBarStyle -->
            <item name="actionBarStyle">@style/MyActionBarStyle</item>
    
            <!-- ...and here we setting appcompat’s color theming attrs -->
            <item name="colorPrimary">@color/my_awesome_red</item>
            <item name="colorPrimaryDark">@color/my_awesome_darker_red</item>
    
            <!-- The rest of your attributes -->
        </style>
    </resources>
    

    Second Problem: You may need to provide some code showing what you've done to this point so it's not a matter of someone writing the entire thing for you.