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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T00:34:25+00:00 2026-05-20T00:34:25+00:00

Some very very strange behaviour was appearing in my Android application. I was extending

  • 0

Some very very strange behaviour was appearing in my Android application.

I was extending Button to replace the standard. In my own button I set:
– TextAppearence (text 16px, bold..)
– BackgroundDrawable (to an selector that replaced the standard button, that used images of 60px)
– Gravity: LEFT|CENTER_VERTICAL.

Whenever the text was enough to make the button have 2 text lines, if it had the property Gravity.CENTER_VERTICAL, a top padding would appear!

This kept me overflowing and googling for weeks… (set paddingTop, singleLine, and other simple solutions didn’t work of course!)

Finally got the solution!!!

 @Override
 protected boolean setFrame(int l, int t, int r, int b) {
  int fixedTopSize = 5;
  return super.setFrame(l,fixedTopSize, r, b-t);
 }

By overriding this method on the extended Button finally i got it to work without the irritating top padding… still i don’t understand why this happens.

Any ideia?

  • 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-20T00:34:25+00:00Added an answer on May 20, 2026 at 12:34 am

    I discovered that it was the Gravity of the Layout together with the gravity from the buttons and the weight (i wasn’t using weightSum just layout_weight) that was messing the layout.

    Very strange but… it was happening.

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

Sidebar

Related Questions

I'm getting some very strange behaviour with HttpWebRequest I hope someone can help me
I'm seeing some very strange behaviour from the Apple Push Notification Servers when the
I'm getting some very strange behaviour with tinyMCE in an ASP.NET MVC 2 beta
I've encountered some very strange behaviour when debugging in VS 2010 with a WCF
I experienced very strange behaviour with a CakePHP site in production. Some views did
I'm seeing some very strange sorting behaviour using CaseInsensitiveComparer.DefaultInvariant. Words that start with a
I've noticed some very strange behaviour today in Code Igniter. I have this locations
I'm trying to visualize Mandelbrot set with OpenGL and have found very strange behaviour
We have a very strange behaviour of a WPF application. Sometimes (not very ofen),
I have been noticing some very strange usage of O(1) in discussion of algorithms

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.