本文整理匯總了Java中com.facebook.drawee.view.SimpleDraweeView.getLayoutParams方法的典型用法代碼示例。如果您正苦於以下問題:Java SimpleDraweeView.getLayoutParams方法的具體用法?Java SimpleDraweeView.getLayoutParams怎麽用?Java SimpleDraweeView.getLayoutParams使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.facebook.drawee.view.SimpleDraweeView
的用法示例。
在下文中一共展示了SimpleDraweeView.getLayoutParams方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onDependentViewChanged
import com.facebook.drawee.view.SimpleDraweeView; //導入方法依賴的package包/類
@Override
public boolean onDependentViewChanged(CoordinatorLayout parent, SimpleDraweeView child, View dependency) {
maybeInitProperties(child, dependency);
final int maxScrollDistance = (int) (mStartToolbarPosition - getStatusBarHeight());
float expandedPercentageFactor = dependency.getY() / maxScrollDistance;
float distanceYToSubtract = ((mStartYPosition - mFinalYPosition)
* (1f - expandedPercentageFactor)) + (child.getHeight()/2);
float distanceXToSubtract = ((mStartXPosition - mFinalXPosition)
* (1f - expandedPercentageFactor)) + (child.getWidth()/2);
float heightToSubtract = ((mStartHeight - finalHeight) * (1f - expandedPercentageFactor));
child.setY(mStartYPosition - distanceYToSubtract);
child.setX(mStartXPosition - distanceXToSubtract);
int proportionalAvatarSize = (int) (mAvatarMaxSize * (expandedPercentageFactor));
CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) child.getLayoutParams();
lp.width = (int) (mStartHeight - heightToSubtract);
lp.height = (int) (mStartHeight - heightToSubtract);
child.setLayoutParams(lp);
return true;
}
示例2: changeImageSize
import com.facebook.drawee.view.SimpleDraweeView; //導入方法依賴的package包/類
/**
* 改變圖片的尺寸
*
* @param imageInfo 獲取的圖片信息
* @param maxWidth 可顯示的最大寬度
* @param view 圖片對象
*/
private static void changeImageSize(ImageInfo imageInfo, int maxWidth, SimpleDraweeView view) {
int height = imageInfo.getHeight();
int width = imageInfo.getWidth();
float scaleWidth = (float) maxWidth / width;
int realHeight = (int) (height * scaleWidth);
int realWidth = (int) (width * scaleWidth);
ViewGroup.LayoutParams params = view.getLayoutParams();
params.height = realHeight;
params.width = realWidth;
view.setLayoutParams(params);
}
示例3: setFresco
import com.facebook.drawee.view.SimpleDraweeView; //導入方法依賴的package包/類
private void setFresco(SimpleDraweeView simpleDraweeView, AlbumInfo albumInfo, int width, boolean isGif) {
if (albumInfo.getWidth() != null && albumInfo.getHeight() != null) {
if (isGif)
simpleDraweeView.setImageURI(albumInfo.getPicUrl());
else
simpleDraweeView.setImageURI(albumInfo.getGifThumbUrl());
ViewGroup.LayoutParams l = simpleDraweeView.getLayoutParams();
l.width = albumInfo.getWidth();
l.height = albumInfo.getHeight();
simpleDraweeView.setLayoutParams(l);
} else
FrescoUtil.setControllerListener(simpleDraweeView, albumInfo, width, isGif);
}
示例4: addSimpleDraweeView
import com.facebook.drawee.view.SimpleDraweeView; //導入方法依賴的package包/類
private void addSimpleDraweeView(SimpleDraweeView view, int width, int height) {
ViewGroup.LayoutParams params = view.getLayoutParams();
if (params == null) {
params = new ViewGroup.LayoutParams(width, height);
}
params.width = width;
params.height = height;
view.setLayoutParams(params);
contentLayout.addView(view);
}