android.widget.Button.requestLayout()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(132)

本文整理了Java中android.widget.Button.requestLayout()方法的一些代码示例,展示了Button.requestLayout()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Button.requestLayout()方法的具体详情如下:
包路径:android.widget.Button
类名称:Button
方法名:requestLayout

Button.requestLayout介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

FrameLayout layout = (FrameLayout) findViewById(R.layout.frame_layout);
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams( 
      FrameLayout.LayoutParams.FILL_PARENT, 
      FrameLayout.LayoutParams.WRAP_CONTENT); 
params.setMargins(30, 10, 0, 0); 
Button btn = (Button) findViewById(R.id.rbutton);
btn.setLayoutParams(params);
btn.requestLayout();

代码示例来源:origin: developer-shivam/PentagonFloatingActionButton

@Override
  public void onAnimationUpdate(ValueAnimator animation) {
    button.setY((float) animation.getAnimatedValue());
    button.requestLayout();
  }
});

代码示例来源:origin: developer-shivam/PentagonFloatingActionButton

@Override
  public void onAnimationUpdate(ValueAnimator animation) {
    button.setX((float) animation.getAnimatedValue());
    button.requestLayout();
  }
});

代码示例来源:origin: stackoverflow.com

Button button = (Button)findViewById(R.id.your_button);
ViewGroup.LayoutParams params = button.getLayoutParams();
params.height = yourHeight;
params.width = yourWidth;
button.requestLayout();

代码示例来源:origin: developer-shivam/PentagonFloatingActionButton

@Override
  public void onAnimationUpdate(ValueAnimator animation) {
    button.setY((float) animation.getAnimatedValue());
    button.requestLayout();
  }
});

代码示例来源:origin: stackoverflow.com

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
  final View createdView = super.onCreateView(inflater, container, savedInstanceState);
  final Button button = (Button) createdView.findViewById(R.id.i_am_button);
  createdView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
    public void onGlobalLayout()
    {
      DisplayMetrics displayMetrics = createdView.getContext().getResources().getDisplayMetrics();
      Log.d(TAG, "Screen Width x Height in Pixels: " + displayMetrics.widthPixels + " x " + displayMetrics.heightPixels);
      button.getLayoutParams().width = 0.60 * displayMetrics.widthPixels;
      button.requestLayout();
      createdView.getViewTreeObserver().removeOnGlobalLayoutListener(this);  //One-shot!
    }
  });
  return createdView;
}

代码示例来源:origin: developer-shivam/PentagonFloatingActionButton

@Override
  public void onAnimationUpdate(ValueAnimator animation) {
    button.getLayoutParams().width = (int) animation.getAnimatedValue();
    button.getLayoutParams().height = (int) animation.getAnimatedValue();
    button.requestLayout();
  }
});

代码示例来源:origin: developer-shivam/PentagonFloatingActionButton

@Override
  public void onAnimationUpdate(ValueAnimator animation) {
    button.getLayoutParams().width = (int) animation.getAnimatedValue();
    button.getLayoutParams().height = (int) animation.getAnimatedValue();
    button.requestLayout();
  }
});

代码示例来源:origin: developer-shivam/PentagonFloatingActionButton

@Override
  public void onAnimationUpdate(ValueAnimator animation) {
    button.setX((float) animation.getAnimatedValue() - button.getLayoutParams().width / 2);
    button.requestLayout();
  }
});

代码示例来源:origin: wythe0102/Mall

LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) dialog.negButton.getLayoutParams();
layoutParams.leftMargin = context.getResources().getDimensionPixelSize(R.dimen.base_ui_mall_dialog_style9_button_child_margin);
dialog.negButton.requestLayout();

相关文章

微信公众号

最新文章

更多

Button类方法