Code example for View

Methods: ofFloatsetBackgroundColorsetBackgroundDrawablesetLayoutParams

0
        super(context, attrs, defStyle);
        initialize(); 
    } 
 
    private void initialize() { 
        mModestyPanel = new View(getContext());
        // If the SizeAdaptiveLayout has a solid background, use it as a transition hint. 
        Drawable background = getBackground();
        if (background instanceof StateListDrawable) {
            StateListDrawable sld = (StateListDrawable) background;
            sld.setState(StateSet.WILD_CARD);
            background = sld.getCurrent();
        } 
        if (background instanceof ColorDrawable) {
            mModestyPanel.setBackgroundDrawable(background);
        } else { 
            mModestyPanel.setBackgroundColor(Color.BLACK);
        } 
        SizeAdaptiveLayout.LayoutParams layout =
                new SizeAdaptiveLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                                                    ViewGroup.LayoutParams.MATCH_PARENT);
        mModestyPanel.setLayoutParams(layout);
        addView(mModestyPanel);
        mFadePanel = ObjectAnimator.ofFloat(mModestyPanel, "alpha", 0f);
        mFadeView = ObjectAnimator.ofFloat(null, "alpha", 0f);
        mAnimatorListener = new BringToFrontOnEnd();
        mTransitionAnimation = new AnimatorSet();
        mTransitionAnimation.play(mFadeView).with(mFadePanel);
        mTransitionAnimation.setDuration(CROSSFADE_TIME);
Stop searching for code, let great code find you!  Add Codota to your java IDE