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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T21:07:50+00:00 2026-06-06T21:07:50+00:00

I am struggling to use the draw 9 patch. I have created the following

  • 0

I am struggling to use the draw 9 patch. I have created the following asset using the draw 9 patch

draw9 patch

However when I embed it into the app using the following code:

<Button android:id="@+id/open_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/open_label"
        android:width="100dip"
       android:background="@drawable/simplebuttonbg"
        />

It doesn’t work and shows the full image

enter image description here

  • 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-06T21:07:52+00:00Added an answer on June 6, 2026 at 9:07 pm

    Edit: I just fixed it in the process of documenting this question- so thought it might be useful to share: ( hope it helps someone)

    1.Basically you can’t just set button background to draw 9 patch.

    1. You need to create a stateless drawable first with the data as such: in your drawables folder

      android:drawable="@drawable/simplebuttonbg_pressed"
      />
       <item
      android:state_focused="true" 
      android:state_enabled="true"
      android:drawable="@drawable/simplebuttonbg_pressed" />
      

    2. then you can apply it as a style or a background brilliantly!

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

Sidebar

Related Questions

I'm really struggling to iron out this issue. When I use the following code
I was struggling with how to use TFS as a source code repository for
I'm struggling with the following scenario and could use some different perspectives to shed
I am really struggling to understand why, when I change my code to use
I use playframework, and I am struggling with a concurrent task: I have a
So I have been struggling with finding a decent C# library to use with
I am using social_auth in my django application to use facebook connect. I have
Here is what I'm struggling with today: I'm trying to draw a graph using
I'm struggling to use Delayed_job (collective idea v2.0 in a Rails 2.3.8 app). I'm
I am struggling to use dojox.mobile.ScrollableView for scrolling horizontally: I have a <div data-dojo-type=dojox.mobile.ScrollableView

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.