Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8202707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T07:16:57+00:00 2026-06-07T07:16:57+00:00

I need some help styling a ListView for an Android application. I am trying

  • 0

I need some help styling a ListView for an Android application. I am trying to look up how to do this type of styling, but I think I am searching on the wrong items.

My data consists of objects being returned by a ContentProvider and a CursorLoader is used to the access the data. The data will have section headers by date. Each item in a section has a category and I would like to color the left most border (margin or padding) with the color code for the category. See the layout xml below. The detail row consists of 3 lines of data with a button at the bottom left position.

Please see this Google Drawing for how the list should look.
Drawing of how I want to style the ListView

Is this formatting possible?

Thank you for any help.

<?xml version="1.0" encoding="utf-8"?>
<!-- 
 *  This file is part of MythTV for Android
 * 
 *  MythTV for Android is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  MythTV for Android is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with MythTV for Android.  If not, see <http://www.gnu.org/licenses/>.
 *   
 * This software can be found at <https://github.com/MythTV-Android/mythtv-for-android/>
 *
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >

<LinearLayout
    android:id="@+id/upcoming_header_row"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:paddingLeft="8dp"
    android:paddingRight="8dp" >

    <TextView
        android:id="@+id/upcoming_header_label"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:textColor="@color/body_text_1" />

</LinearLayout>

<LinearLayout
    android:id="@+id/upcoming_detail_row"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:paddingLeft="8dp"
    android:paddingRight="8dp" >

    <TextView
        android:id="@+id/upcoming_title"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:textColor="@color/body_text_1"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <TextView
        android:id="@+id/upcoming_sub_title"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:textColor="@color/body_text_1" />

        <RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:paddingLeft="8dp"
            android:paddingRight="8dp" >

            <TextView
                android:id="@+id/upcoming_channel"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_centerVertical="true"
                android:textColor="@color/body_text_1" />

            <TextView
                android:id="@+id/upcoming_start_time"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:textColor="@color/body_text_1" />

            <Button
                android:id="@+id/upcoming_dont_record"
                android:layout_width="40dp"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:text="@string/btn_upcoming_dont_record"
                android:textColor="@color/body_text_1"
                android:textSize="@dimen/text_size_small" />

    </RelativeLayout>

</LinearLayout>

</LinearLayout>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T07:16:59+00:00Added an answer on June 7, 2026 at 7:16 am

    You just need another LinearLayout in Horizontal orientation and then a View to hold the color. Nest your existing upcoming_detail_row inside the new LinearLayout as the second element and the new View (to hold the color) as the first element.

    Then you can set the background color of that view programatically.

    Here is an example adapted from your layout.

    <?xml version="1.0" encoding="utf-8"?>
    

    <LinearLayout
        android:id="@+id/upcoming_header_row"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:paddingLeft="8dp"
        android:paddingRight="8dp" >
    
        <TextView
            android:id="@+id/upcoming_header_label"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:textColor="#000000" />
    </LinearLayout>
    
    <LinearLayout
        android:id="@+id/newLayout"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >
    
        <View
            android:id="@+id/view1"
            android:layout_width="10dp"
            android:layout_height="fill_parent"
            android:background="#ff0000" />
    
        <LinearLayout
            android:id="@+id/upcoming_detail_row"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:paddingLeft="8dp"
            android:paddingRight="8dp" >
    
            <TextView
                android:id="@+id/upcoming_title"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:text="title"
                android:textAppearance="?android:attr/textAppearanceLarge"
                android:textColor="#000000" />
    
            <TextView
                android:id="@+id/upcoming_sub_title"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:text="subtitle"
                android:textColor="#000000" />
    
            <RelativeLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:paddingLeft="8dp"
                android:paddingRight="8dp" >
    
                <TextView
                    android:id="@+id/upcoming_channel"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentLeft="true"
                    android:layout_centerVertical="true"
                    android:text="channel"
                    android:textColor="#000000" />
    
                <TextView
                    android:id="@+id/upcoming_start_time"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerInParent="true"
                    android:text="startTime"
                    android:textColor="#000000" />
    
                <Button
                    android:id="@+id/upcoming_dont_record"
                    android:layout_width="40dp"
                    android:layout_height="wrap_content"
                    android:layout_alignParentRight="true"
                    android:text="button"
                    android:textColor="#000000"
                    android:textSize="14sp" />
            </RelativeLayout>
        </LinearLayout>
    </LinearLayout>
    

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Need some help with a #jQuery issue. Can someone look at this and tell
I need help with some CSS styling. I've tried various options with Firebug and
Need some help to solve this. I have a gridview and inside the gridview
Need some help with this problem in implementing with XSLT, I had already implemented
Need some help gathering thoughts on this issue. Our team is moving ahead with
So I think I am almost there conceptually but need some missing pointers. Objective
Need some help with what is probably a pretty basic SQL query. I'm trying
Need some help with this error. Fresh wordpress 2.9 install... Fatal error: Cannot instantiate
Need some help on understanding how to do this; I'm going to be running
Need some help please with this error : TypeError : 'unicode' object does not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.