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

x33g5p2x  于2022-01-20 转载在 其他  
字(2.6k)|赞(0)|评价(0)|浏览(141)

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

ImageButton.requestLayout介绍

暂无

代码示例

代码示例来源:origin: safetysystemtechnology/audio-recorder-button

public void unRevealSizeToRemove() {
  this.mImageButton.getLayoutParams().width = ((removeImageWidth > 0) && (removeImageWidth < DEFAULT_REMOVE_ICON_SIZE)) ? removeImageWidth : DEFAULT_REMOVE_ICON_SIZE;
  this.mImageButton.getLayoutParams().height = ((removeImageHeight > 0) && (removeImageHeight < DEFAULT_REMOVE_ICON_SIZE)) ? removeImageHeight : DEFAULT_REMOVE_ICON_SIZE;
  this.mImageButton.requestLayout();
}

代码示例来源:origin: safetysystemtechnology/audio-recorder-button

public void changeSizeToRemove() {
  if (this.mImageButton.getLayoutParams().width != this.mImageView.getWidth()) {
    this.mImageButton.getLayoutParams().width = this.mImageView.getWidth();
    this.mImageButton.getLayoutParams().height = this.mImageView.getHeight();
    this.mImageButton.requestLayout();
    this.mImageButton.setX(0);
  }
}

代码示例来源:origin: CUTR-at-USF/OpenTripPlanner-for-Android

mBtnMyLocation.requestLayout();
  mBtnHandle.requestLayout();
} else {
  Log.w(OTPApp.TAG, "Not possible to move down itineraries spinner");

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

final ImageButton button = (ImageButton) findViewById(R.id.my_button);
final LinearLayout button_container = (LinearLayout) findViewById(R.id.my_window);

button.setOnClickListener(new OnClickListener() {
  public void onClick (View v) {

    // change button image
    int imgNo = (int) (Math.random() * 9) + 1; // 9 images in the folder, start at index 1
    int imgID = getResources().getIdentifier("chef" + imgNo, "drawable", getPackageName());
    button.setBackgroundResource(imgID);
    button.requestLayout(); // size to fit content

    // move button to a random location
    int x = (int) (Math.random() * (button_container.getWidth() - button.getWidth()));
    int y = (int) (Math.random() * (button_container.getHeight() - button.getHeight()));
    button_container.setPadding(x, y, 0, 0);
  }   
});
button.performClick(); // run once at the start to set image and position randomly

代码示例来源:origin: evrencoskun/TableViewSampleApp

@Override
public void onSortingStatusChanged(SortState pSortState) {
  super.onSortingStatusChanged(pSortState);
  // It is necessary to remeasure itself.
  column_header_container.getLayoutParams().width = LinearLayout.LayoutParams.WRAP_CONTENT;
  controlSortState(pSortState);
  column_header_textview.requestLayout();
  column_header_sort_button.requestLayout();
  column_header_container.requestLayout();
  itemView.requestLayout();
}

相关文章

ImageButton类方法