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 8021809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T22:05:50+00:00 2026-06-04T22:05:50+00:00

I have a ListViewwith (the width is fill_parent) several buttons on it. The button

  • 0

I have a ListViewwith (the width is fill_parent) several buttons on it. The button contains an icon on the left and the text on the right. The problem is that whenever I put my finger on the button, the green background only covers up to the length of your text. Is there a let the green color cover the whole button?

Suppose this is a button in the text view, where @ is the icon and text is the text.

[@ text     ]

When I move my finger on the button, only this much is covered by green:

[#####|     ]
  • 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-04T22:05:51+00:00Added an answer on June 4, 2026 at 10:05 pm

    You shouldn’t use that as a means to achieve the icon / text on a button.

    Try something like this:

    <LinearLayout android:id="@+id/descriptiveName"
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content"
    android:orientation="horizontal" 
    android:layout_gravity="center_horizontal" >
    
    <ImageView android:id="@+id/btnIcon"
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content"
        android:src="@drawable/img" 
        android:layout_gravity="center_vertical"/>
    
    <TextView android:id="@+id/btnText" 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" 
        android:text="text"
        android:textColor="#6B6B6B"/>
    

    get a reference to the LinearLayout the same way you would a button and you can set onClick Listeners for it in the same way too.

    You can add a background to the LinearLayout and make it a selector so that it will look visually like a button too.

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

Sidebar

Related Questions

I'm trying to have a ListView with icon and text but there is a
I have a ListView with few elements, each item contains two buttons with a
I'm trying to create a ListView with items that have two lines of text,
I have an arraylist with multiple hashmaps that contains information that comes from a
I have got ListView with a custom Adapter. Every row contains clickable buttons and
I have a listview with an imagelist so I can show pictures near text
I have a listview with two buttons in my main.xml layout. On click of
I have a ListView with an image over the right hand side. and I
I have a ListView with a Button below it. When I fill the list
I'm just getting my feet wet with Android and have built a UI that

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.