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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:20:18+00:00 2026-05-24T08:20:18+00:00

In iOS, if I set a button’s background to an image, when I press

  • 0

In iOS, if I set a button’s background to an image, when I press the button, the whole content of the button (including the text) will be shadowed. Can I achieve the same effect in Android, or do I have to use different images for different states? Also, even if I use different images for different states, how do I make the text also shadowed? A dirty way is to set a OnClickListener to the button and programatically shadow the text when pressed, but are there any other ways?

  • 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-24T08:20:19+00:00Added an answer on May 24, 2026 at 8:20 am

    I´ve been trying to find a solution for this for a while now but couldn´t find anything so I came up with a pretty neat solution which works on all image buttons. Just like iOS.

    • Create a Black, 10% transparent image and save it as PNG. I call it button_pressed.png. You can use this image, http://img84.imageshack.us/img84/7924/buttonpressed.png

    • Create a drawable called something relevant, I call it “button_pressed_layout.xml”

      <?xml version="1.0" encoding="utf-8"?>
      <selector xmlns:android=" http://schemas.android.com/apk/res/android">
          <item android:state_pressed="true" android:drawable="@drawable/button_pressed"  />
      </selector>
      
    • Now put your button image in the LinearLayout and then the Button inside the LinearLayout. In the Button use button_pressed_layout.xml as background.

          <LinearLayout 
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:background="@drawable/button_image">
              <Button
                  android:id="@+id/myButtonId"
                  android:text="@string/Continue"
                  android:layout_width="fill_parent"
                  android:layout_height="fill_parent"
                  android:background="@drawable/button_pressed_layout"
                  android:textColor="#FFF"
                  android:textSize="16dp" >                   
              </Button>
          </LinearLayout>
      

    That´s it!

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

Sidebar

Related Questions

How do I create a png image from text in iOS?
In an iOS app, how can I determine whether a back button is displayed?
I'm currently attempting to set up background audio for an app I'm developing for
I have an iOS app that displays content from a sqlite db in a
I have the following button: http://dl.dropbox.com/u/3564087/button.png However this image has a blank area on
using XCode 3.2.6, Base SDK iOS 4.3 I set iOS Deployment Target to iOS
I have an iOS app where I set the Required Device Capabilities config setting
When building a custom frame/view in iOS code, how do you set its rotation
How to run application which is build using ios-sdk-4.3 in ios-sdk-4.0.I set build target
Possible Duplicate: NSBackgroundColorAttributeName-like attribute in NSAttributedString on iOS? I am trying to set the

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.