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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:51:59+00:00 2026-05-22T02:51:59+00:00

Usually, there’s a bit effect when we press a button. But when I set

  • 0

Usually, there’s a bit effect when we press a button. But when I set gradient background for a button by creating a shape border.xml:

<?xml version="1.0" encoding="utf-8"?>
<shape
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <stroke android:width="1px" android:color="#cccccc" />
    <corners android:radius="6px" />
    <gradient
      android:startColor="#d8d8d8"
      android:endColor="#f9f2f9"
      android:angle="90" /> 
</shape>

and button:

        <Button
        android:id="@+id/visibility"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center_vertical"
        android:drawableLeft="@drawable/idle"
        android:singleLine="true"           
        android:padding="5px"
        android:textSize="14px"
        android:textColor="#444444"
        android:textStyle="bold"
        android:typeface="sans"
        android:layout_marginLeft="5px"
        android:layout_marginRight="5px"    
        android:background="@drawable/border"
        android:clickable="true">
    </Button>

the effect when press the button is lost, the button now is just like a textview, nothing is changed when I click on it.
But if I delete this line in button, everything’s ok:

android:background="@drawable/border"

So any solutions to don’t be lost the effect when press the button, or any solutions to make a button has border and gradient background without use shape?
Thanks!

  • 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-05-22T02:51:59+00:00Added an answer on May 22, 2026 at 2:51 am

    You have to use a StateListDrawable for the button background, supplying different background images for each state (pressed, focused, etc.).

    It will be much simpler to simply not change the button background at all.

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

Sidebar

Related Questions

Usually there is one launcher on an Android device. But sometimes users install a
In visual studio or any other IDE, usually there are two build configurations, Debug
My application server needs to notify users about some events via email. Usually there
In methods of controllers, there are usually many checks for doing the right thing.
Design patterns are usually related to object oriented design. Are there design patterns for
I'm using some semi-transparent PNGs as background-images on various websites. These are usually something
I'm usually creating 1 .as file per font and exports these .as files to
I want to add more than one function to a ViewHelper. Usually there is
When we deploy applications, there is usually a separate machine for production and development.
Usually there are lib, bin and spec(or test) folders in the ruby project(at least,

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.