View Single Post
Old 08-30-2011, 08:17 AM   #4 (permalink)
laurre
New Member
 
Join Date: Aug 2011
Model: 7100T
PIN: N/A
Carrier: Az
Posts: 4
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: Display problem overriding ButtonField

It seems that another thing is done in the super.layout() method. Seems to be an internal stuff, for text positioning I think.

The technique I have found, even if it is not the best one I guess :

- don't override layout
- override getPreferredHeight() and getPreferredWidth() :

Code:
public int getPreferredHeight() {
     if (isStyle(USE_ALL_HEIGHT)) {
          return Integer.MAX_VALUE;
     }
     return super.getPreferredHeight();
}

public int getPreferredWidth() {
     if (isStyle(USE_ALL_WIDTH)) {
          return Integer.MAX_VALUE;
     }
     return super.getPreferredWidth();
}
I hope this works in any situations. I know it is not very very clean, if you have a better idea...
Offline   Reply With Quote