GifView.java 文件源码

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

项目:quotograph 作者:
@SuppressLint("NewApi")
private void setViewAttributes(Context context, AttributeSet attrs, int defStyle) {

    /**
     * Starting from HONEYCOMB(Api Level:11) have to turn off HW acceleration to draw
     * Movie on Canvas.
     */
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }

    final TypedArray array = context.obtainStyledAttributes(attrs,
            R.styleable.GifView, defStyle, R.style.Widget_GifView);

    //-1 is default value
    mMovieResourceId = array.getResourceId(R.styleable.GifView_gif, -1);
    mPaused = array.getBoolean(R.styleable.GifView_paused, false);
    mScaleToFillWidth = array.getBoolean(R.styleable.GifView_scaleToFillWidth, false);

    array.recycle();

    if (mMovieResourceId != -1) {
        movie = Movie.decodeStream(getResources().openRawResource(mMovieResourceId));
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号