本文整理了Java中android.widget.ImageButton.setAdjustViewBounds()
方法的一些代码示例,展示了ImageButton.setAdjustViewBounds()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ImageButton.setAdjustViewBounds()
方法的具体详情如下:
包路径:android.widget.ImageButton
类名称:ImageButton
方法名:setAdjustViewBounds
暂无
代码示例来源:origin: stackoverflow.com
mTable = (TableLayout)findViewById(R.id.table);
LayoutInflater inflater = getLayoutInflater();
for (int j=0; j<4; j++) {
View row = inflater.inflate(R.layout.row, mTable,false);
TableRow tr = (TableRow)row.findViewById(R.id.trow);
for (int i=0; i<4; i++) {
View image = inflater.inflate(R.layout.image, tr, false);
ImageButton ib = (ImageButton)image.findViewById(R.id.image);
ib.setAdjustViewBounds(true);
ib.setImageResource(mCardIds[j*4+i]);
tr.addView(ib);
}
mTable.addView(tr);
}
代码示例来源:origin: stackoverflow.com
ImageButton mImageButton = new ImageButton(context);
mImageButton.setImageResource(R.drawable.close_button);
RelativeLayout.LayoutParams paramsB = new RelativeLayout.LayoutParams(width, height);
paramsB.addRule(RelativeLayout.ALIGN_PARENT_TOP);
paramsB.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
mImageButton.setLayoutParams(paramsB);
mImageButton.setAdjustViewBounds(true);
mImageButton.setBackgroundDrawable(null);
mRelativeLayout.addView(mImageButton);
mImageButton.setScaleType(ImageView.ScaleType.FIT_CENTER);
代码示例来源:origin: stackoverflow.com
RelativeLayout relativeLayout = (RelativeLayout) findViewById(R.id.mainLayout);
FrameLayout frameLayout = new FrameLayout(this);
frameLayout.setLayoutParams(
new FrameLayout.LayoutParams(
FrameLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.MATCH_PARENT));
View mWebView = new View(this);
mWebView.setBackgroundColor(Color.parseColor("#FF0000"));
mWebView.setLayoutParams(
new ViewGroup.LayoutParams(
FrameLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.MATCH_PARENT));
ImageButton mImageButton = new ImageButton(this);
mImageButton.setImageResource(android.R.drawable.star_big_on);
mImageButton.setLayoutParams(new ViewGroup.LayoutParams(200, 200));
mImageButton.setAdjustViewBounds(true);
frameLayout.addView(mWebView);
frameLayout.addView(mImageButton);
relativeLayout.addView(frameLayout);
代码示例来源:origin: stackoverflow.com
private void addImageButton(RelativeLayout mainLayout, int x, int y, int width, int height, OnClickListener onClickListener){
ImageButton imageButton = new ImageButton(this);
imageButton.setAdjustViewBounds(true);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
params.height = height;
params.width = width;
imageButton.setLayoutParams(params);
imageButton.setScaleType(ImageView.ScaleType.FIT_XY);
imageButton.setImageDrawable(getResources().getDrawable(R.drawable.ic_launcher));
params.leftMargin = x - width/2;
params.topMargin = y - height/2;
imageButton.setOnClickListener(onClickListener);
mainLayout.addView(imageButton);
}
代码示例来源:origin: bitstadium/HockeySDK-Android
imageButton.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams
.WRAP_CONTENT, Gravity.BOTTOM));
imageButton.setAdjustViewBounds(true);
imageButton.setImageDrawable(getSystemIcon("ic_menu_delete"));
imageButton.setBackgroundResource(0);
代码示例来源:origin: stackoverflow.com
mTv.setTextSize(11);
mIb.setAdjustViewBounds(true);
mIb.setMaxHeight(Utils.convertDp(80, this));
mIb.setMaxWidth(Utils.convertDp(80, this));
代码示例来源:origin: marzika/Snapprefs
saveSnapButton.setScaleType(ImageView.ScaleType.FIT_XY);
saveSnapButton.setPadding(0,0,0,0);
saveSnapButton.setAdjustViewBounds(true);
saveSnapButton.setBackgroundColor(0);
saveSnapButton.setAlpha((float) Preferences.getInt(Prefs.BUTTON_OPACITY) / 100);
代码示例来源:origin: stackoverflow.com
coverImage.setLayoutParams(imgparam);
coverImage.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
coverImage.setAdjustViewBounds(true);
coverImage.setOnClickListener( new OnClickListener(){
public void onClick(View arg0) {
downloadedCover.setLayoutParams(imgparam);
downloadedCover.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
downloadedCover.setAdjustViewBounds(true);
内容来源于网络,如有侵权,请联系作者删除!