本文整理了Java中android.widget.ImageView.getPaddingTop()
方法的一些代码示例,展示了ImageView.getPaddingTop()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ImageView.getPaddingTop()
方法的具体详情如下:
包路径:android.widget.ImageView
类名称:ImageView
方法名:getPaddingTop
暂无
代码示例来源:origin: chrisbanes/PhotoView
private int getImageViewHeight(ImageView imageView) {
return imageView.getHeight() - imageView.getPaddingTop() - imageView.getPaddingBottom();
}
代码示例来源:origin: androidquery/androidquery
private void adjust(ImageView iv, Bitmap bm, boolean done){
int vw = getWidth(iv);
if(vw <= 0) return;
int dw = bm.getWidth();
int dh = bm.getHeight();
int th = targetHeight(dw, dh, vw) + iv.getPaddingTop() + iv.getPaddingBottom();
LayoutParams lp = iv.getLayoutParams();
if(lp == null) return;
int vh = lp.height;
if(th != vh){
lp.height = th;
iv.setLayoutParams(lp);
}
if(done) adjusted = true;
}
代码示例来源:origin: androidquery/androidquery
private void draw(Canvas canvas, ImageView iv, Bitmap bm){
Matrix m = getMatrix(iv, bm);
if(m != null){
int vpad = iv.getPaddingTop() + iv.getPaddingBottom();
int hpad = iv.getPaddingLeft() + iv.getPaddingRight();
if(vpad > 0 || hpad > 0){
canvas.clipRect(0, 0, iv.getWidth() - hpad, iv.getHeight() - vpad);
}
canvas.drawBitmap(bm, m, getPaint());
}
if(!adjusted){
adjust(iv, bm, true);
}
}
代码示例来源:origin: stackoverflow.com
public static int[] getBitmapOffset(ImageView img, Boolean includeLayout) {
int[] offset = new int[2];
float[] values = new float[9];
Matrix m = img.getImageMatrix();
m.getValues(values);
offset[0] = (int) values[5];
offset[1] = (int) values[2];
if (includeLayout) {
ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) img.getLayoutParams();
int paddingTop = (int) (img.getPaddingTop() );
int paddingLeft = (int) (img.getPaddingLeft() );
offset[0] += paddingTop + lp.topMargin;
offset[1] += paddingLeft + lp.leftMargin;
}
return offset;
}
代码示例来源:origin: wangdan/AisenWeiBo
lp.height = defHeight + coverHeight;
imgCover.setLayoutParams(lp);
imgCover.setPadding(imgCover.getPaddingLeft(), imgCover.getPaddingTop(), imgCover.getPaddingRight(), defHeight);
代码示例来源:origin: recruit-lifestyle/FloatingView
/**
* 削除アイコンの中心Y座標を取得します。
*
* @return 削除アイコンの中心Y座標
*/
float getTrashIconCenterY() {
final ImageView iconView = hasActionTrashIcon() ? mActionTrashIconView : mFixedTrashIconView;
final float iconViewHeight = iconView.getHeight();
final float iconViewPaddingBottom = iconView.getPaddingBottom();
final float iconHeight = iconViewHeight - iconView.getPaddingTop() - iconViewPaddingBottom;
final float y = mRootView.getHeight() - mTrashIconRootView.getY() - iconViewHeight + iconViewPaddingBottom;
return y + iconHeight / 2;
}
代码示例来源:origin: recruit-lifestyle/FloatingView
/**
* Window上での描画領域を取得します。
* 当たり判定の矩形を表します。
*
* @param outRect 変更を加えるRect
*/
void getWindowDrawingRect(Rect outRect) {
// Gravityが逆向きなので、矩形の当たり判定も上下逆転(top/bottom)
// top(画面上で下方向)の判定を多めに設定
final ImageView iconView = hasActionTrashIcon() ? mActionTrashIconView : mFixedTrashIconView;
final float iconPaddingLeft = iconView.getPaddingLeft();
final float iconPaddingTop = iconView.getPaddingTop();
final float iconWidth = iconView.getWidth() - iconPaddingLeft - iconView.getPaddingRight();
final float iconHeight = iconView.getHeight() - iconPaddingTop - iconView.getPaddingBottom();
final float x = mTrashIconRootView.getX() + iconPaddingLeft;
final float y = mRootView.getHeight() - mTrashIconRootView.getY() - iconPaddingTop - iconHeight;
final int left = (int) (x - TARGET_CAPTURE_HORIZONTAL_REGION * mMetrics.density);
final int top = -mRootView.getHeight();
final int right = (int) (x + iconWidth + TARGET_CAPTURE_HORIZONTAL_REGION * mMetrics.density);
final int bottom = (int) (y + iconHeight + TARGET_CAPTURE_VERTICAL_REGION * mMetrics.density);
outRect.set(left, top, right, bottom);
}
代码示例来源:origin: MukeshKumar009/EcomSample
private int getImageViewHeight(ImageView imageView) {
if (null == imageView)
return 0;
return imageView.getHeight() - imageView.getPaddingTop() - imageView.getPaddingBottom();
}
代码示例来源:origin: albinmathew/PhotoCrop
private int getImageViewHeight(ImageView imageView) {
if (null == imageView)
return 0;
return imageView.getHeight() - imageView.getPaddingTop() - imageView.getPaddingBottom();
}
代码示例来源:origin: Meiqia/MeiqiaSDK-Android
protected int getImageViewHeight(ImageView imageView) {
if (null == imageView)
return 0;
return imageView.getHeight() - imageView.getPaddingTop() - imageView.getPaddingBottom();
}
代码示例来源:origin: SwiftyWang/FingerColoring-Android
private int getImageViewHeight(ImageView imageView) {
if (null == imageView)
return 0;
return imageView.getHeight() - imageView.getPaddingTop() - imageView.getPaddingBottom();
}
代码示例来源:origin: xu649526275/MyMVPDemo
private int getImageViewHeight(ImageView imageView) {
if (null == imageView)
return 0;
return imageView.getHeight() - imageView.getPaddingTop() - imageView.getPaddingBottom();
}
代码示例来源:origin: SuperKotlin/PictureViewer
private int getImageViewHeight(ImageView imageView) {
if (null == imageView)
return 0;
return imageView.getHeight() - imageView.getPaddingTop() - imageView.getPaddingBottom();
}
代码示例来源:origin: MrWangChong/DragPhotoView
private int getImageViewHeight(ImageView imageView) {
return imageView.getHeight() - imageView.getPaddingTop() - imageView.getPaddingBottom();
}
代码示例来源:origin: wufenglincheng/ImageTrans
private int getImageViewHeight(ImageView imageView) {
return imageView.getHeight() - imageView.getPaddingTop() - imageView.getPaddingBottom();
}
代码示例来源:origin: derry/delion
@Override
protected void onBindView(View view) {
super.onBindView(view);
int padding = getContext().getResources().getDimensionPixelSize(
R.dimen.site_setttings_icon_padding);
ImageView icon = (ImageView) view.findViewById(android.R.id.icon);
icon.setPadding(padding, icon.getPaddingTop(), 0, icon.getPaddingBottom());
}
}
代码示例来源:origin: adolfAn/FBReader_AS
protected final void setIcon(ImageView imageView, ZLTree<?> tree) {
if (tree.hasChildren()) {
if (isOpen(tree)) {
imageView.setImageResource(R.drawable.ic_list_group_open);
} else {
imageView.setImageResource(R.drawable.ic_list_group_closed);
}
} else {
imageView.setImageResource(R.drawable.ic_list_group_empty);
}
imageView.setPadding(25 * (tree.Level - 1), imageView.getPaddingTop(), 0, imageView.getPaddingBottom());
}
}
代码示例来源:origin: com.googlecode.android-query/android-query
private void draw(Canvas canvas, ImageView iv, Bitmap bm){
Matrix m = getMatrix(iv, bm);
if(m != null){
int vpad = iv.getPaddingTop() + iv.getPaddingBottom();
int hpad = iv.getPaddingLeft() + iv.getPaddingRight();
if(vpad > 0 || hpad > 0){
canvas.clipRect(0, 0, iv.getWidth() - hpad, iv.getHeight() - vpad);
}
canvas.drawBitmap(bm, m, getPaint());
}
if(!adjusted){
adjust(iv, bm, true);
}
}
代码示例来源:origin: stackoverflow.com
final ImageView iv_YourImage = (ImageView) findViewById(R.id.iv_imageview);
public boolean onTouch(View v, MotionEvent event){
int topParam = iv_YourImage.getPaddingTop();
int rightParam = iv_YourImage.getPaddingRight();
int maxTopParam = topParam+iv_YourImage.getMaxHeight();
int maxRightParam = rightParam + iv_YourImage.getMaxWidth();
if(event.getX>topParam&&event.getX<maxTopParam){
//the x coordinate is in your image... do the same to Y
}
return true;
}
代码示例来源:origin: ianhanniballake/TripleSolitaire
/**
* Gets the screen location for the top card in the waste
*
* @return The exact (x,y) position of the top card in the waste
*/
private Point getWasteLoc() {
final RelativeLayout waste = findViewById(R.id.waste);
final ImageView waste1View = findViewById(R.id.waste1);
final float x = waste.getX() + waste.getPaddingLeft() + waste1View.getX() + waste1View.getPaddingLeft();
final float y = waste.getY() + waste.getPaddingTop() + waste1View.getY() + waste1View.getPaddingTop();
return new Point((int) x, (int) y);
}
内容来源于网络,如有侵权,请联系作者删除!