Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

actionBar in Ribbit project not styling after downloading the custumized zip files

so i downloaded a zip file from http://jgilfelt.github.io/android-actionbarstylegenerator/ after i had done all my custom styling , and i added the various drawables files in their respective folders. But for some reason ,when i run my app, the styles on the actionBar hasnt changed. Also i did target this custom styling in my androidManifestFile, that is i did android:theme="@style/Theme.Snapshare" .

In MainActivity.java i am extending ActionBarActivity like this:

public class MainActivity extends ActionBarActivity implements ActionBar.TabListener {

    public static final String TAG = MainActivity.class.getSimpleName();

bellow is my styles.xml file in my values folder.

<?xml version="1.0" encoding="utf-8"?>
<!-- File created by the Android Action Bar Style Generator

     Copyright (C) 2011 The Android Open Source Project
     Copyright (C) 2012 readyState Software Ltd

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<resources>

    <style name="Theme.Snapshare" parent="@style/Theme.AppCompat.Light.DarkActionBar">
        <item name="android:actionBarItemBackground">@drawable/selectable_background_snapshare
        </item>
        <item name="android:popupMenuStyle">@style/PopupMenu.Snapshare</item>
        <item name="android:dropDownListViewStyle">@style/DropDownListView.Snapshare</item>
        <item name="android:actionBarTabStyle">@style/ActionBarTabStyle.Snapshare</item>
        <item name="android:actionDropDownStyle">@style/DropDownNav.Snapshare</item>
        <item name="android:actionBarStyle">@style/ActionBar.Solid.Snapshare</item>
        <item name="android:actionModeBackground">@drawable/cab_background_top_snapshare</item>
        <item name="android:actionModeSplitBackground">@drawable/cab_background_bottom_snapshare
        </item>
        <item name="android:actionModeCloseButtonStyle">@style/ActionButton.CloseMode.Snapshare
        </item>
        <item name="android:editTextBackground">@drawable/apptheme_edit_text_holo_light</item>

    </style>

    <style name="ActionBar.Solid.Snapshare" parent="@android:style/Widget.Holo.Light.ActionBar.Solid">
        <item name="android:background">@drawable/ab_solid_snapshare</item>
        <item name="android:backgroundStacked">@drawable/ab_stacked_solid_snapshare</item>
        <item name="android:backgroundSplit">@drawable/ab_bottom_solid_snapshare</item>
        <item name="android:progressBarStyle">@style/ProgressBar.Snapshare</item>
    </style>

    <style name="ActionBar.Transparent.Snapshare" parent="@android:style/Widget.Holo.Light.ActionBar">
        <item name="android:background">@drawable/ab_transparent_snapshare</item>
        <item name="android:progressBarStyle">@style/ProgressBar.Snapshare</item>
    </style>

    <style name="PopupMenu.Snapshare" parent="@android:style/Widget.Holo.Light.ListPopupWindow">
        <item name="android:popupBackground">@drawable/menu_dropdown_panel_snapshare</item>
    </style>

    <style name="DropDownListView.Snapshare"
           parent="@android:style/Widget.Holo.Light.ListView.DropDown">
        <item name="android:listSelector">@drawable/selectable_background_snapshare</item>
    </style>

    <style name="ActionBarTabStyle.Snapshare"
           parent="@android:style/Widget.Holo.Light.ActionBar.TabView">
        <item name="android:background">@drawable/tab_indicator_ab_snapshare</item>
    </style>

    <style name="DropDownNav.Snapshare" parent="@android:style/Widget.Holo.Light.Spinner">
        <item name="android:background">@drawable/spinner_background_ab_snapshare</item>
        <item name="android:popupBackground">@drawable/menu_dropdown_panel_snapshare</item>
        <item name="android:dropDownSelector">@drawable/selectable_background_snapshare</item>
    </style>

    <style name="ProgressBar.Snapshare"
           parent="@android:style/Widget.Holo.Light.ProgressBar.Horizontal">
        <item name="android:progressDrawable">@drawable/progress_horizontal_snapshare</item>
    </style>

    <style name="ActionButton.CloseMode.Snapshare"
           parent="@android:style/Widget.Holo.Light.ActionButton.CloseMode">
        <item name="android:background">@drawable/btn_cab_done_snapshare</item>
    </style>

    <!-- this style is only referenced in a Light.DarkActionBar based theme -->
    <style name="Theme.Snapshare.Widget" parent="@android:style/Theme.Holo">
        <item name="android:popupMenuStyle">@style/PopupMenu.Snapshare</item>
        <item name="android:dropDownListViewStyle">@style/DropDownListView.Snapshare</item>
    </style>


    <style name="AuthBackground">
        <item name="android:background">@drawable/background_fill</item>

    </style>

    <style name="AuthBackgroundImage">
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_height">match_parent</item>
        <item name="android:layout_alignParentBottom">true</item>
        <item name="android:layout_alignParentRight">true</item>
        <item name="android:background">@drawable/background</item>
        <item name="android:scaleType">fitStart</item>
        <item name="android:contentDescription">@string/content_desc_background</item>
    </style>

    <style name="AuthTitle">
        <item name="android:layout_width">wrap_content</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:textSize">60sp</item>
        <item name="android:layout_alignParentTop">true</item>
        <item name="android:layout_centerHorizontal">true</item>
        <item name="android:textColor">@android:color/white</item>
        <item name="android:textStyle">bold</item>
        <item name="android:layout_marginTop">78dp</item>
        <item name="android:text">@string/app_name</item>
    </style>

    <style name="AuthSubTitle" parent="AuthTitle">
        <item name="android:layout_below">@+id/title</item>
        <item name="android:textSize">13sp</item>
        <item name="android:text">@string/subtitle</item>
        <item name="android:layout_marginTop">0dp</item>
        <item name="android:layout_alignParentTop">false</item>

    </style>

    <style name="AuthFieldContainer">
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:layout_below">@id/subtitle</item>
        <item name="android:orientation">vertical</item>
        <item name="android:layout_marginTop">@dimen/login_vertical_margin</item>
        <item name="android:layout_marginLeft">@dimen/activity_horizontal_margin</item>
        <item name="android:layout_marginRight">@dimen/activity_horizontal_margin</item>
        <item name="android:paddingLeft">@dimen/login_horizontal_padding</item>
        <item name="android:paddingRight">@dimen/login_horizontal_padding</item>
        <item name="android:paddingTop">@dimen/login_vertical_margin</item>
        <item name="android:paddingBottom">@dimen/login_vertical_margin</item>
        <item name="android:background">@android:color/white</item>
    </style>

    <style name="AuthEditText">
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:textColorHint">@color/light_gray</item>
        <item name="android:textSize">17sp</item>
        <item name="android:ems">10</item>
    </style>

    <style name="AuthButton">
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:background">@drawable/button_custom</item>
        <item name="android:layout_marginLeft">@dimen/activity_horizontal_margin</item>
        <item name="android:layout_marginRight">@dimen/activity_horizontal_margin</item>
        <item name="android:textSize">13sp</item>
        <item name="android:textColor">@color/text_color</item>
    </style>


</resources>

4 Answers

Harry James
Harry James
14,780 Points

Hey teles!

Can you make sure that you set the theme in your AndroidManifest.xml file like this:

        android:theme="@style/Theme.Snapshare"

Yes, thats what i have, but its not changing in color, but in the styles.xml. within the <style name="Theme.Snapshate ----> when i add an item of name "colorPrimary" and specify the color, it changes the color for the action bar and the tabs. But for some reason it doenst follow that of the zip file with the customized designs i have.

Harry James
Harry James
14,780 Points

Hmm... That's odd...

The tool is actually now deprecated and perhaps that has something to do with it.

I would try the website again though and see if you can get the right colours - perhaps they downloaded incorrectly?

I actually just tried out the site and it gave me the correct values so, I'm not sure why this would be...

Are you using android studio?

Harry James
Harry James
14,780 Points

I use both Android Studio and Eclipse for development but when I took this project, I used Eclipse (Android Studio was not in its official beta stage and very buggy at the time I was taking this project).