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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:18:30+00:00 2026-05-27T07:18:30+00:00

I was following a tutorial on creating custom buttons . If I apply the

  • 0

I was following a tutorial on creating custom buttons. If I apply the style to the button directly it works, but if I apply the style to the theme using android:buttonStyle it doesn’t work.

An example – Here is the style xml with the button style applied:
values/styles.xml

<resources>
    <style name="MyTheme" parent="android:Theme.Light">
       <!-- the button gets styled but is no longer clickable 
            if i do it like this -->
       <item name="android:buttonStyle">@style/ButtonText</item>
    </style>

    <style name="ButtonText">
        <item name="android:layout_width">fill_parent</item>
        <item name="android:layout_height">wrap_content</item>
        <item name="android:textColor">#ffffff</item>
        <item name="android:background">@drawable/ruddy_orange_button</item>
    </style>
</resources>

drawable/ruddy_orange_button.xml:

    <item android:state_pressed="true">
        <shape>
            <solid android:color="#70c656" />
            <stroke android:width="1dp" android:color="#53933f" />
            <corners android:radius="3dp" />
            <padding android:bottom="10dp" android:left="10dp" android:right="10dp" android:top="10dp" />
        </shape>
    </item>
   <item>
        <shape>
            <gradient android:angle="270" android:endColor="#fd4d4d" android:startColor="#f24b4b" />
            <stroke android:width="1dp" android:color="#f04a4a" />
            <corners android:radius="4dp" />
            <padding android:bottom="10dp" android:left="10dp" android:right="10dp" android:top="10dp" />
        </shape> 
    </item>
</selector>

However if I apply the style directly to the button it works:

<Button
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    style="@style/ButtonText"
    android:text="hello there" />

Any pointers on what I’m doing wrong here?

I tested this on Android 2.3.3

Source is on github.

  • 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-27T07:18:31+00:00Added an answer on May 27, 2026 at 7:18 am

    Try this:

    <style name="ButtonText" parent="@android:style/Widget.Button">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm following a tutorial on creating the NerdDinner using ASP.Net MVC. However, I'm using
I'm following this tutorial for creating automated sitemaps in CakePHP. Everything is easy, but
So I followed the following tutorial on creating custom views associated with device orientations:
I'm following this tutorial on creating buttons with CSS. http://www.secondpicture.com/tutorials/web_design/css_ul_li_horizontal_css_menu.html The background for the
I've been following a tutorial on http://michaelellerbeck.com/2009/01/12/creating-a-service-for-visual-basic-2008-express/ for creating a service using VB Express
I am following a tutorial for creating a simple application in Android , and
I'm creating an Internet Explorer plugin using C#. I've been following a tutorial where
I am following the following tutorial ( http://www.highoncoding.com/Articles/642_Creating_a_Stock_Widget_in_ASP_NET_MVC_Application.aspx ) on using ajax to render
I am following the tutorial http://www.asp.net/mvc/tutorials/older-versions/models-(data)/creating-model-classes-with-linq-to-sql-cs . I'm getting the following error: The type
I'm new Django, and i've been following a tutorial on creating a blog. I've

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.