FlipLoadingLayout.java 文件源码

java
阅读 29 收藏 0 点赞 0 评论 0

项目:Hotspot-master-devp 作者:
@Override
protected void onLoadingDrawableSet(Drawable imageDrawable) {
    if (null != imageDrawable) {
        final int dHeight = imageDrawable.getIntrinsicHeight();
        final int dWidth = imageDrawable.getIntrinsicWidth();

        /**
         * We need to set the width/height of the ImageView so that it is
         * square with each side the size of the largest drawable dimension.
         * This is so that it doesn't clip when rotated.
         */
        ViewGroup.LayoutParams lp = mHeaderImage.getLayoutParams();
        lp.width = lp.height = Math.max(dHeight, dWidth);
        mHeaderImage.requestLayout();

        /**
         * We now rotate the Drawable so that is at the correct rotation,
         * and is centered.
         */
        mHeaderImage.setScaleType(ScaleType.MATRIX);
        Matrix matrix = new Matrix();
        matrix.postTranslate((lp.width - dWidth) / 2f, (lp.height - dHeight) / 2f);
        matrix.postRotate(getDrawableRotationAngle(), lp.width / 2f, lp.height / 2f);
        mHeaderImage.setImageMatrix(matrix);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号