ChartProgressBar.java 文件源码

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

项目:ChartProgressBar-Android 作者:
private void clickBarOn(FrameLayout frameLayout) {

        pins.get((int) frameLayout.getTag()).setVisibility(View.VISIBLE);

        isOldBarClicked = true;

        int childCount = frameLayout.getChildCount();

        for (int i = 0; i < childCount; i++) {

            View childView = frameLayout.getChildAt(i);
            if (childView instanceof LinearLayout) {

                LinearLayout linearLayout = (LinearLayout) childView;
                Bar bar = (Bar) linearLayout.getChildAt(0);
                TextView titleTxtView = (TextView) linearLayout.getChildAt(1);

                LayerDrawable layerDrawable = (LayerDrawable) bar.getProgressDrawable();
                layerDrawable.mutate();

                ScaleDrawable scaleDrawable = (ScaleDrawable) layerDrawable.getDrawable(1);

                GradientDrawable progressLayer = (GradientDrawable) scaleDrawable.getDrawable();
                if (mPinBackgroundColor != 0) {
                    if (progressLayer != null) {
                        progressLayer.setColor(ContextCompat.getColor(mContext, mProgressClickColor));
                    }

                } else {
                    if (progressLayer != null) {
                        progressLayer.setColor(ContextCompat.getColor(mContext, android.R.color.holo_green_dark));
                    }
                }

                if (mBarTitleSelectedColor > 0) {
                    titleTxtView.setTextColor(ContextCompat.getColor(mContext, mBarTitleSelectedColor));
                } else {
                    titleTxtView.setTextColor(ContextCompat.getColor(mContext, android.R.color.holo_green_dark));
                }

            }
        }
    }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号