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

  • Home
  • SEARCH
  • 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 9132707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:21:33+00:00 2026-06-17T08:21:33+00:00

In reference to these questions: Adding gradient effect to TextView in a ListView generates

  • 0

In reference to these questions:

Adding gradient effect to TextView in a ListView generates NPE
How to change color and font on ListView

I would like to know how to go about setting the background of a TextView in a ListView with gradient effect?

In one of the questions above, I ended up having the gradient effect added to the text in the TextView. And after skimming through the second question, it seems I can add only fixed background colors.

How do I go about adding gradient to the background?

Should I make a CustomListAdapter?

  • 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-17T08:21:34+00:00Added an answer on June 17, 2026 at 8:21 am

    You just need to create a drawable resource (see an example below), and add it to the layout you created for your ListItem.

    The drawable (in your res\drawable folder – name it whatever – listgrad.xml for ex) could look like:

    <shape xmlns:android="http://schemas.android.com/apk/res/android"
        android:shape="rectangle">
        <gradient
          android:startColor="@color/gradient_start"
          android:endColor="@color/gradient_end"
          android:angle="-270" /> 
    </shape>
    

    The you would add it to the layout for your list item (the layout.xml file you define for this) like this code snippet:

    <TextView
            android:id="@+id/ranking_order"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/list_grad"
            />
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First, I'd like to apologize for adding to the myriad of questions on this
I first had a problem with adding a Reference for Bing Maps (http://stackoverflow.com/questions/13239597/why-can-i-not-reference-bing-maps-in-my-app); but
Is there a guide/reference anyone would recommend to pick up C++ specifically if you
Is there any quick guide/reference to list all the countries and its states/provinces? Like
I hit this weird namespace issue when adding my first 'Service Reference' to a
A library I am using gets a reference to the main window by adding
I have a nested ASP.NET ListView, the outer one presenting groups of questions, and
Are there any reference cards or cheats sheets available for UML?
I'm stumped. There are several threads out there that reference a similar problem, but
Is there a good reference for writing code in x86 assembly. I am writing

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.