示例#1
0
 void updateText(int state) {
   if (!states.isInState(state)) return;
   if (title != null) {
     title.setText(states.getTitle());
     if (states.getTitlecolor() != null) title.setTextColor(states.getTitlecolor());
     if (states.getShadowColor() != null) title.setShadowColor(states.getShadowColor());
   }
 }
示例#2
0
 float getPrefferedWidth() {
   xm_model().measure(0, 0);
   int max = xm_model().getMeasuredWidth();
   if (title != null) {
     title.xm_model().measure(0, 0);
     max = Math.max(max, title.xm_model().getMeasuredWidth() + 16);
   }
   if (fore != null) {
     fore.xm_model().measure(0, 0);
     max = Math.max(max, fore.xm_model().getMeasuredWidth());
   }
   return IOSView.x2IOS(max);
 }
示例#3
0
  private void initText() {
    if (title == null) {
      title = new UILabel();
      title.setBackgroundColor(UIColor.clearColor);
      title.setTextAlignment(UITextAlignment.Center);
      title.setFont(BUTTONFONT);
      CGSize size = getFrame().size;
      title.setFrame(new CGRect(0, 0, size.width, size.height));

      addSubview(title);
      if (fore != null) { // Fix Z-order
        fore.removeFromSuperview();
        addSubview(fore);
      }
    }
  }
示例#4
0
 @Override
 public void setFrame(CGRect frame) {
   super.setFrame(frame);
   frame.origin.x = 0;
   frame.origin.y = 0;
   if (title != null) title.setFrame(frame);
   if (fore != null) fore.setFrame(frame);
 }
示例#5
0
 public UIFont getFont() {
   initText();
   return title.getFont();
 }
示例#6
0
 public void setFont(UIFont font) {
   initText();
   title.setFont(font);
 }
示例#7
0
 public CGSize getTitleShadowOffset() {
   initText();
   return title.getShadowOffset();
 }
示例#8
0
 public void setTitleShadowOffset(CGSize titleShadowOffset) {
   initText();
   title.setShadowOffset(titleShadowOffset);
 }