コード例 #1
0
ファイル: UIButton.java プロジェクト: selmanon/crossmobile
 private void initForeground() {
   if (fore == null) {
     fore = new UIImageView();
     if (imagefills) fore.setContentMode(UIViewContentMode.ScaleToFill);
     else fore.setContentMode(UIViewContentMode.Center);
     CGSize size = getFrame().size;
     fore.setFrame(new CGRect(0, 0, size.width, size.height));
     addSubview(fore);
   }
 }
コード例 #2
0
ファイル: UIButton.java プロジェクト: selmanon/crossmobile
 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
ファイル: UIButton.java プロジェクト: selmanon/crossmobile
 @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);
 }
コード例 #4
0
ファイル: UIButton.java プロジェクト: selmanon/crossmobile
  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);
      }
    }
  }