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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T23:02:13+00:00 2026-05-14T23:02:13+00:00

I’m probably just being daft but my Google searches are not working out well.

  • 0

I’m probably just being daft but my Google searches are not working out well.

I have a bunch of buttons i add in code that all have dynamic text. I’ve set a background image for each of these buttons since the default greybutton doesn’t work well for my application.

This works perfectly and when the text size (or content) changes, the button automatically grows to accommodate the expanded text. What doesn’t work is that I’d like the button to scale proportionally – i.e. if the background image is round, i’d like it to stay round rather than oval as the button gets bigger.

With an imagebutton, there is a property “Adjust view bounds” that does exactly this but I cant put text on an imagebutton. Is there something equivalent for a regular button?

or am I going about this wrong?

i also tried setting the width of the button in code, but I can’t seem to determine the new height (button.getHeight() returns 0)

  • 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-14T23:02:13+00:00Added an answer on May 14, 2026 at 11:02 pm

    ok i found one way to do it…
    I modified the patch-9 to have its expandable area be the maximum on both axis.

    then used the DisplayMetrics like this:

            DisplayMetrics metrics = new DisplayMetrics();
            getWindowManager().getDefaultDisplay().getMetrics(metrics);
            buttonView.setGravity(Gravity.CENTER);
    
            int buttonSize=(int) Math.floor(metrics.density*1.6*fontSize);
            buttonView.setWidth(buttonSize);
            buttonView.setHeight(buttonSize);
    

    where fontSize is the size of the font in DIP that i’m placing on each button. In this case, since I only have a single letter on each button, i don’t need to worry about the text length, but one could obviously tweak this to handle that situation as well.

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

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I have a French site that I want to parse, but am running into
This could be a duplicate question, but I have no idea what search terms
I have a bunch of posts stored in text files formatted in yaml/textile (from
I am trying to loop through a bunch of documents I have to put
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
this is what i have right now Drawing an RSS feed into the php,

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.