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 Implementing Designs for Android Customizing a GridView for Friends Customizing the GridView

James N
James N
17,864 Points

padding doesn't appear!

when I load up the gridview, the new padding that I just added isn't there!

fragment_friends.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity$DummySectionFragment" >

    <GridView
        android:id="@+id/friendsGrid"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:numColumns="3"
        android:horizontalSpacing="@dimen/user_grid_spacing"
        android:verticalSpacing="@dimen/user_grid_spacing"
        android:clipToPadding="false">
    </GridView>

    <TextView
        android:id="@android:id/empty"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/empty_friends_label"
        android:gravity="center_horizontal"
        android:textSize="32sp"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_marginTop="117dp"
        android:textColor="@color/text_color"/>

</RelativeLayout>
styles.xml
<?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 xmlns:android="http://schemas.android.com/apk/res/android">

    <style name="Theme.Ribbit" parent="@android:style/Theme.Holo.Light">
        <item name="android:actionBarItemBackground">@drawable/selectable_background_ribbit</item>
        <item name="android:popupMenuStyle">@style/PopupMenu.Ribbit</item>
        <item name="android:dropDownListViewStyle">@style/DropDownListView.Ribbit</item>
        <item name="android:actionBarTabStyle">@style/ActionBarTabStyle.Ribbit</item>
        <item name="android:actionDropDownStyle">@style/DropDownNav.Ribbit</item>
        <item name="android:actionBarStyle">@style/ActionBar.Solid.Ribbit</item>
        <item name="android:actionModeBackground">@drawable/cab_background_top_ribbit</item>
        <item name="android:actionModeSplitBackground">@drawable/cab_background_bottom_ribbit</item>
        <item name="android:actionModeCloseButtonStyle">@style/ActionButton.CloseMode.Ribbit</item>
        <item name="android:editTextBackground">@drawable/apptheme_edit_text_holo_light</item>
        <item name="android:actionOverflowButtonStyle">@style/Theme.Ribbit.Overflow</item>
        <item name="android:listViewStyle">@style/Theme.Ribbit.LightPurpleBackground</item>
        <item name="android:gridViewStyle">@style/Theme.Ribbit.LightPurpleBackground.GridView</item>
    </style>

    <style name="Theme.Ribbit.LightPurpleBackground.GridView">
        <item name="android:padding">@dimen/user_grid_spacing</item>
    </style>

    <style name="Theme.Ribbit.LightPurpleBackground">
        <item name="android:background">@color/light_purple_background</item>
        <item name="android:divider">@null</item>
    </style>

    <style name="Theme.Ribbit.Overflow" parent="@android:style/Widget.ActionButton.Overflow">
        <item name="android:src">@drawable/ic_menu_overflow</item>
    </style>

    <style name="ActionBar.Solid.Ribbit" parent="@android:style/Widget.Holo.Light.ActionBar.Solid">
        <item name="android:background">@drawable/ab_solid_ribbit</item>
        <item name="android:backgroundStacked">@drawable/ab_stacked_solid_ribbit</item>
        <item name="android:backgroundSplit">@drawable/ab_bottom_solid_ribbit</item>
        <item name="android:progressBarStyle">@style/ProgressBar.Ribbit</item>
        <item name="android:titleTextStyle">@style/ActionBar.Solid.Ribbit.TitleTextStyle</item>
    </style>

    <style name="ActionBar.Solid.Ribbit.TitleTextStyle" 
        parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title">
        <item name="android:textColor">@color/text_color</item>        
    </style>

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

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

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

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

    <style name="DropDownNav.Ribbit" parent="@android:style/Widget.Holo.Light.Spinner">
        <item name="android:background">@drawable/spinner_background_ab_ribbit</item>
        <item name="android:popupBackground">@drawable/menu_dropdown_panel_ribbit</item>
        <item name="android:dropDownSelector">@drawable/selectable_background_ribbit</item>
    </style>

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

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

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

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

    <style name="AuthBackgroundImage">
        <item name="android:scaleType">fitStart</item>
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_height">match_parent</item>
        <item name="android:layout_alignParentLeft">true</item>
        <item name="android:layout_alignParentTop">true</item>
        <item name="android:src">@drawable/background</item>
    </style>

    <style name="AuthTitle" parent="android:Widget.Holo.Light.TextView">
        <item name="android:layout_marginTop">32dp</item>
        <item name="android:textColor">@android:color/white</item>
        <item name="android:textSize">60sp</item>
        <item name="android:textStyle">bold</item>
        <item name="android:layout_width">wrap_content</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:layout_alignParentTop">true</item>
        <item name="android:layout_centerHorizontal">true</item>
        <item name="android:text">@string/app_name</item>
    </style>

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

    <style name="AuthFieldContainer">
        <item name="android:background">@android:color/white</item>
        <item name="android:layout_marginLeft">@dimen/activity_horizontal_margin</item>
        <item name="android:layout_marginRight">@dimen/activity_horizontal_margin</item>
        <item name="android:layout_marginTop">@dimen/login_vertical_margin</item>
        <item name="android:orientation">vertical</item>
        <item name="android:paddingBottom">@dimen/login_vertical_padding</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_padding</item>        
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:layout_below">@id/subtitle</item>
    </style>

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

    <style name="AuthButton" parent="android:Widget.Holo.Light.Button">
        <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:textColor">@color/text_color</item>
        <item name="android:textSize">13sp</item>
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_height">wrap_content</item>
    </style>
</resources>
user_item.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="@android:color/white">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="44dp"
        android:id="@+id/nameLabel"
        android:maxLines="2"
        android:padding="4dp"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"/>
</RelativeLayout>