android.animation.LayoutTransition Java Examples
The following examples show how to use
android.animation.LayoutTransition.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LoginFragment.java From mosby with Apache License 2.0 | 7 votes |
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); loginButton.setMode(ActionProcessButton.Mode.ENDLESS); int startDelay = getResources().getInteger(android.R.integer.config_mediumAnimTime) + 100; LayoutTransition transition = new LayoutTransition(); transition.enableTransitionType(LayoutTransition.CHANGING); transition.setStartDelay(LayoutTransition.APPEARING, startDelay); transition.setStartDelay(LayoutTransition.CHANGE_APPEARING, startDelay); loginForm.setLayoutTransition(transition); }
Example #2
Source File: PageIndicator.java From LB-Launcher with Apache License 2.0 | 7 votes |
private void enableLayoutTransitions() { LayoutTransition transition = getLayoutTransition(); transition.enableTransitionType(LayoutTransition.APPEARING); transition.enableTransitionType(LayoutTransition.DISAPPEARING); transition.enableTransitionType(LayoutTransition.CHANGE_APPEARING); transition.enableTransitionType(LayoutTransition.CHANGE_DISAPPEARING); }
Example #3
Source File: DebugView.java From debugdrawer with Apache License 2.0 | 7 votes |
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) private static void enableLayoutTransitions(ViewGroup viewGroup) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { // Remove the status bar color. The DrawerLayout is responsible for drawing it from now on. LayoutTransition lt = new LayoutTransition(); lt.enableTransitionType(LayoutTransition.CHANGING); viewGroup.setLayoutTransition(lt); } else { Timber.w("Error enabling LayoutTransitions, only supported for API14+."); } }
Example #4
Source File: PersistentSearchView.java From PersistentSearchView with Apache License 2.0 | 7 votes |
private void setUpLayoutTransition() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { RelativeLayout searchRoot = (RelativeLayout) findViewById(R.id.search_root); LayoutTransition layoutTransition = new LayoutTransition(); layoutTransition.setDuration(DURATION_LAYOUT_TRANSITION); if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN) { // layoutTransition.enableTransitionType(LayoutTransition.CHANGING); layoutTransition.enableTransitionType(LayoutTransition.CHANGE_DISAPPEARING); layoutTransition.setStartDelay(LayoutTransition.CHANGING, 0); } layoutTransition.setStartDelay(LayoutTransition.CHANGE_DISAPPEARING, 0); mSearchCardView.setLayoutTransition(layoutTransition); } }
Example #5
Source File: Workspace.java From TurboLauncher with Apache License 2.0 | 7 votes |
private void setupLayoutTransition() { // We want to show layout transitions when pages are deleted, to close the gap. mLayoutTransition = new LayoutTransition(); mLayoutTransition.enableTransitionType(LayoutTransition.DISAPPEARING); mLayoutTransition.enableTransitionType(LayoutTransition.CHANGE_DISAPPEARING); mLayoutTransition.disableTransitionType(LayoutTransition.APPEARING); mLayoutTransition.disableTransitionType(LayoutTransition.CHANGE_APPEARING); setLayoutTransition(mLayoutTransition); }
Example #6
Source File: LabelLayout.java From mosby with Apache License 2.0 | 7 votes |
private void init() { View.inflate(getContext(), R.layout.view_label_layout, this); LayoutTransition transition = new LayoutTransition(); transition.enableTransitionType(LayoutTransition.CHANGING); this.setLayoutTransition(transition); adapter = new LabelAdapter(getContext()); popUpWindow = new ListPopupWindow(getContext()); popUpWindow.setAnchorView(this); popUpWindow.setAdapter(adapter); popUpWindow.setWidth(DimensUtils.dpToPx(getContext(), 140)); popUpWindow.setOnDismissListener(new PopupWindow.OnDismissListener() { @Override public void onDismiss() { showLabel(); } }); popUpWindow.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Label label = (Label) adapter.getItem(position); if (!label.getName().equals(mail.getLabel())) { presenter.setLabel(mail, label.getName()); popUpWindow.dismiss(); } } }); setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { loadData(false); } }); }
Example #7
Source File: LayoutAnimations.java From codeexamples-android with Eclipse Public License 1.0 | 6 votes |
private void setupTransition(LayoutTransition transition) { CheckBox customAnimCB = (CheckBox) findViewById(R.id.customAnimCB); CheckBox appearingCB = (CheckBox) findViewById(R.id.appearingCB); CheckBox disappearingCB = (CheckBox) findViewById(R.id.disappearingCB); CheckBox changingAppearingCB = (CheckBox) findViewById(R.id.changingAppearingCB); CheckBox changingDisappearingCB = (CheckBox) findViewById(R.id.changingDisappearingCB); transition.setAnimator(LayoutTransition.APPEARING, appearingCB.isChecked() ? (customAnimCB.isChecked() ? customAppearingAnim : defaultAppearingAnim) : null); transition.setAnimator(LayoutTransition.DISAPPEARING, disappearingCB.isChecked() ? (customAnimCB.isChecked() ? customDisappearingAnim : defaultDisappearingAnim) : null); transition.setAnimator(LayoutTransition.CHANGE_APPEARING, changingAppearingCB.isChecked() ? (customAnimCB.isChecked() ? customChangingAppearingAnim : defaultChangingAppearingAnim) : null); transition.setAnimator(LayoutTransition.CHANGE_DISAPPEARING, changingDisappearingCB.isChecked() ? (customAnimCB.isChecked() ? customChangingDisappearingAnim : defaultChangingDisappearingAnim) : null); }
Example #8
Source File: PropertyAnimationActivity.java From Study_Android_Demo with Apache License 2.0 | 6 votes |
private void doLayoutAnimator() { LayoutTransition layoutTransition = new LayoutTransition(); layoutTransition.setAnimator(LayoutTransition.APPEARING, getObjectAnimator(false)); layoutTransition.setAnimator(LayoutTransition.DISAPPEARING, getObjectAnimator(true)); layoutTransition.setDuration(2000); //mPuppet's parentView ViewGroup contentView = (ViewGroup) ((ViewGroup) getWindow().getDecorView().findViewById(android.R.id.content)).getChildAt(0); contentView.setLayoutTransition(layoutTransition); if (contentView.findViewById(R.id.view_puppet) == null) { contentView.addView(mPuppet); } else { contentView.removeView(mPuppet); } }
Example #9
Source File: OForm.java From hr with GNU Affero General Public License v3.0 | 6 votes |
private void init(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { mFirstModeChange = true; mContext = context; if (attrs != null) { TypedArray types = mContext.obtainStyledAttributes(attrs, R.styleable.OForm); mModel = types.getString(R.styleable.OForm_modelName); mEditable = types.getBoolean(R.styleable.OForm_editableMode, false); autoUIGenerate = types.getBoolean(R.styleable.OForm_autoUIGenerate, true); icon_tint_color = types.getColor(R.styleable.OForm_controlIconTint, -1); types.recycle(); } initForm(); LayoutTransition transition = new LayoutTransition(); setLayoutTransition(transition); }
Example #10
Source File: LayoutTransitionFragment.java From AndroidAll with Apache License 2.0 | 6 votes |
private LayoutTransition createTransitionChange() { LayoutTransition mTransitioner = new LayoutTransition(); //入场动画:view在这个容器中消失时触发的动画 ObjectAnimator animIn = ObjectAnimator.ofFloat(null, "rotationY", 0f, 360f, 0f); mTransitioner.setAnimator(LayoutTransition.APPEARING, animIn); //出场动画:view显示时的动画 ObjectAnimator animOut = ObjectAnimator.ofFloat(null, "rotation", 0f, 90f, 0f); mTransitioner.setAnimator(LayoutTransition.DISAPPEARING, animOut); PropertyValuesHolder pvhLeft = PropertyValuesHolder.ofInt("left", 0, 100, 0); PropertyValuesHolder pvhTop = PropertyValuesHolder.ofInt("top", 0, 0); PropertyValuesHolder pvhRight = PropertyValuesHolder.ofInt("right", 0, 0); PropertyValuesHolder pvhBottom = PropertyValuesHolder.ofInt("bottom", 0, 0); Animator changeAppearAnimator = ObjectAnimator.ofPropertyValuesHolder(layoutTransitionGroup, pvhLeft, pvhTop, pvhRight, pvhBottom); mTransitioner.setAnimator(LayoutTransition.CHANGE_APPEARING, changeAppearAnimator); /* 1, LayoutTransition.CHANGE_APPEARING/CHANGE_DISAPPEARING 必须配合PropertyValuesHolder使用才能有效果(使用ObjectAnimator无效). */ return mTransitioner; }
Example #11
Source File: AccordionView.java From Android_accordion_view with MIT License | 6 votes |
/*** * This function is used to prepare the layout after the initialize funciton but is called when the developer PROGRAMATICALLY adds * the accordion from the class. Hence, the accordion does not have the UI elements (children) yet * @param context */ private void prepareLayoutWithoutChildren(Context context) { initializeViewWithoutChildren(context); partition.setVisibility(isPartitioned ? VISIBLE : INVISIBLE); heading.setText(headingString); paragraph.setVisibility(VISIBLE); //paragraph.getViewTreeObserver().addOnGlobalLayoutListener(globalLayoutListener); if (isAnimated) { headingLayout.setLayoutTransition(new LayoutTransition()); } else { headingLayout.setLayoutTransition(null); } if (isExpanded) expand(); else collapse(); setOnClickListenerOnHeading(); }
Example #12
Source File: CardStreamLinearLayout.java From android-BatchStepSensor with Apache License 2.0 | 6 votes |
@TargetApi(Build.VERSION_CODES.HONEYCOMB) public void setCardStreamAnimator( CardStreamAnimator animators ){ if( animators == null ) mAnimators = new CardStreamAnimator.EmptyAnimator(); else mAnimators = animators; LayoutTransition layoutTransition = getLayoutTransition(); if( layoutTransition != null ){ layoutTransition.setAnimator( LayoutTransition.APPEARING, mAnimators.getAppearingAnimator(getContext()) ); layoutTransition.setAnimator( LayoutTransition.DISAPPEARING, mAnimators.getDisappearingAnimator(getContext()) ); } }
Example #13
Source File: PropertyAnimationActivity.java From Android-Animation-Set with Apache License 2.0 | 6 votes |
private void doLayoutAnimator() { LayoutTransition layoutTransition = new LayoutTransition(); layoutTransition.setAnimator(LayoutTransition.APPEARING, getObjectAnimator(false)); layoutTransition.setAnimator(LayoutTransition.DISAPPEARING, getObjectAnimator(true)); layoutTransition.setDuration(2000); //mPuppet's parentView ViewGroup contentView = (ViewGroup) ((ViewGroup) getWindow().getDecorView().findViewById(android.R.id.content)).getChildAt(0); contentView.setLayoutTransition(layoutTransition); if (contentView.findViewById(R.id.view_puppet) == null) { contentView.addView(mPuppet); } else { contentView.removeView(mPuppet); } }
Example #14
Source File: GiftControl.java From LiveGiftLayout with Apache License 2.0 | 6 votes |
/** * @param giftLayoutParent 存放礼物控件的父容器 * @param giftLayoutNums 礼物控件的数量 * @return */ public GiftControl setGiftLayout(LinearLayout giftLayoutParent, @NonNull int giftLayoutNums) { if (giftLayoutNums <= 0) { throw new IllegalArgumentException("GiftFrameLayout数量必须大于0"); } if (giftLayoutParent.getChildCount() > 0) {//如果父容器没有子孩子,就进行添加 return this; } mGiftLayoutParent = giftLayoutParent; mGiftLayoutMaxNums = giftLayoutNums; LayoutTransition transition = new LayoutTransition(); transition.setAnimator(LayoutTransition.CHANGE_APPEARING, transition.getAnimator(LayoutTransition.CHANGE_APPEARING)); transition.setAnimator(LayoutTransition.APPEARING, transition.getAnimator(LayoutTransition.APPEARING)); transition.setAnimator(LayoutTransition.DISAPPEARING, transition.getAnimator(LayoutTransition.CHANGE_APPEARING)); transition.setAnimator(LayoutTransition.CHANGE_DISAPPEARING, transition.getAnimator(LayoutTransition.DISAPPEARING)); mGiftLayoutParent.setLayoutTransition(transition); return this; }
Example #15
Source File: CardStreamLinearLayout.java From android-play-places with Apache License 2.0 | 6 votes |
@TargetApi(Build.VERSION_CODES.HONEYCOMB) public void setCardStreamAnimator( CardStreamAnimator animators ){ if( animators == null ) mAnimators = new CardStreamAnimator.EmptyAnimator(); else mAnimators = animators; LayoutTransition layoutTransition = getLayoutTransition(); if( layoutTransition != null ){ layoutTransition.setAnimator( LayoutTransition.APPEARING, mAnimators.getAppearingAnimator(getContext()) ); layoutTransition.setAnimator( LayoutTransition.DISAPPEARING, mAnimators.getDisappearingAnimator(getContext()) ); } }
Example #16
Source File: LayoutAnimationsActivity.java From AndroidAnimationExercise with Apache License 2.0 | 6 votes |
private void setupTransition(LayoutTransition transition) { CheckBox customAnimCB = (CheckBox) findViewById(R.id.customAnimCB); CheckBox appearingCB = (CheckBox) findViewById(R.id.appearingCB); CheckBox disappearingCB = (CheckBox) findViewById(R.id.disappearingCB); CheckBox changingAppearingCB = (CheckBox) findViewById(R.id.changingAppearingCB); CheckBox changingDisappearingCB = (CheckBox) findViewById(R.id.changingDisappearingCB); transition.setAnimator(LayoutTransition.APPEARING, appearingCB.isChecked() ? (customAnimCB.isChecked() ? customAppearingAnim : defaultAppearingAnim) : null); transition.setAnimator(LayoutTransition.DISAPPEARING, disappearingCB.isChecked() ? (customAnimCB.isChecked() ? customDisappearingAnim : defaultDisappearingAnim) : null); transition.setAnimator(LayoutTransition.CHANGE_APPEARING, changingAppearingCB.isChecked() ? (customAnimCB.isChecked() ? customChangingAppearingAnim : defaultChangingAppearingAnim) : null); transition.setAnimator(LayoutTransition.CHANGE_DISAPPEARING, changingDisappearingCB.isChecked() ? (customAnimCB.isChecked() ? customChangingDisappearingAnim : defaultChangingDisappearingAnim) : null); }
Example #17
Source File: CardStreamLinearLayout.java From sensors-samples with Apache License 2.0 | 6 votes |
@TargetApi(Build.VERSION_CODES.HONEYCOMB) public void setCardStreamAnimator( CardStreamAnimator animators ){ if( animators == null ) mAnimators = new CardStreamAnimator.EmptyAnimator(); else mAnimators = animators; LayoutTransition layoutTransition = getLayoutTransition(); if( layoutTransition != null ){ layoutTransition.setAnimator( LayoutTransition.APPEARING, mAnimators.getAppearingAnimator(getContext()) ); layoutTransition.setAnimator( LayoutTransition.DISAPPEARING, mAnimators.getDisappearingAnimator(getContext()) ); } }
Example #18
Source File: IndicatorDots.java From lock-screen with MIT License | 6 votes |
private void initView(Context context) { if (mIndicatorType == 0) { for (int i = 0; i < mPinLength; i++) { View dot = new View(context); emptyDot(dot); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(mDotDiameter, mDotDiameter); params.setMargins(mDotSpacing, 0, mDotSpacing, 0); dot.setLayoutParams(params); addView(dot); } } else if (mIndicatorType == 2) { LayoutTransition layoutTransition = new LayoutTransition(); layoutTransition.setDuration(DEFAULT_ANIMATION_DURATION); layoutTransition.setStartDelay(layoutTransition.APPEARING, 0); setLayoutTransition(layoutTransition); } }
Example #19
Source File: HashtagView.java From hashtag-view with MIT License | 5 votes |
private void prepareLayoutTransition() { if (isDynamic) { layoutTransition = new LayoutTransition(); layoutTransition.setStagger(LayoutTransition.APPEARING, 250); layoutTransition.setAnimateParentHierarchy(false); } }
Example #20
Source File: CustomItemVerticalLayout.java From PagerBottomTabStrip with Apache License 2.0 | 5 votes |
public void initialize(List<BaseTabItem> items, boolean animateLayoutChanges) { mItems.clear(); mItems.addAll(items); if (animateLayoutChanges) { setLayoutTransition(new LayoutTransition()); } //添加按钮到布局,并注册点击事件 int n = mItems.size(); for (int i = 0; i < n; i++) { final BaseTabItem tabItem = mItems.get(i); tabItem.setChecked(false); this.addView(tabItem); tabItem.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { int index = mItems.indexOf(tabItem); if (index >= 0) { setSelect(index); } } }); } //默认选中第一项 mSelected = 0; mItems.get(0).setChecked(true); }
Example #21
Source File: PageIndicator.java From TurboLauncher with Apache License 2.0 | 5 votes |
private void disableLayoutTransitions() { LayoutTransition transition = getLayoutTransition(); transition.disableTransitionType(LayoutTransition.APPEARING); transition.disableTransitionType(LayoutTransition.DISAPPEARING); transition.disableTransitionType(LayoutTransition.CHANGE_APPEARING); transition.disableTransitionType(LayoutTransition.CHANGE_DISAPPEARING); }
Example #22
Source File: MaterialItemVerticalLayout.java From PagerBottomTabStrip with Apache License 2.0 | 5 votes |
public void initialize(List<BaseTabItem> items, boolean animateLayoutChanges, boolean doTintIcon, int color) { mItems.clear(); mItems.addAll(items); mItemTintIcon = doTintIcon; mItemDefaultColor = color; if (animateLayoutChanges) { setLayoutTransition(new LayoutTransition()); } //添加按钮到布局,并注册点击事件 int n = mItems.size(); for (int i = 0; i < n; i++) { final BaseTabItem tabItem = mItems.get(i); tabItem.setChecked(false); this.addView(tabItem); tabItem.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { int index = mItems.indexOf(tabItem); if (index >= 0) { setSelect(index); } } }); } //默认选中第一项 mSelected = 0; mItems.get(0).setChecked(true); }
Example #23
Source File: Toolbar.java From nfcard with GNU General Public License v3.0 | 5 votes |
@SuppressLint("NewApi") public Toolbar(ViewGroup toolbar) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) toolbar.setLayoutTransition(new LayoutTransition()); this.toolbar = toolbar; }
Example #24
Source File: PageIndicator.java From LB-Launcher with Apache License 2.0 | 5 votes |
public PageIndicator(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PageIndicator, defStyle, 0); mMaxWindowSize = a.getInteger(R.styleable.PageIndicator_windowSize, 15); mWindowRange[0] = 0; mWindowRange[1] = 0; mLayoutInflater = LayoutInflater.from(context); a.recycle(); // Set the layout transition properties LayoutTransition transition = getLayoutTransition(); transition.setDuration(175); }
Example #25
Source File: TableView.java From SortableTableView with Apache License 2.0 | 5 votes |
/** * Creates a new TableView with the given context. * * @param context The context that shall be used. * @param attributes The attributes that shall be set to the view. * @param styleAttributes The style attributes that shall be set to the view. */ public TableView(final Context context, final AttributeSet attributes, final int styleAttributes) { super(context, attributes, styleAttributes); setOrientation(LinearLayout.VERTICAL); setAttributes(attributes); setupTableHeaderView(attributes); setupTableDataView(attributes, styleAttributes); layoutTransition = new LayoutTransition(); }
Example #26
Source File: LayoutUtils.java From FastLayout with Apache License 2.0 | 5 votes |
public static LayoutTransition getDisabledLayoutTransition() { if (Build.VERSION.SDK_INT > 10) { LayoutTransition layoutTransition = new LayoutTransition(); if (Build.VERSION.SDK_INT >= 17) { layoutTransition.disableTransitionType(LayoutTransition.DISAPPEARING); } return layoutTransition; } return null; }
Example #27
Source File: LoadingDialogHeaderView.java From Capstone-Project with MIT License | 5 votes |
private void initializeViews(Context context) { LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); layoutInflater.inflate(R.layout.view_loading_dialog_header, this); // bind views ButterKnife.bind(this); // set layout params LayoutParams layoutParams = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); setLayoutParams(layoutParams); LayoutTransition layoutTransition = new LayoutTransition(); setLayoutTransition(layoutTransition); }
Example #28
Source File: RecyclerView.java From kripton with Apache License 2.0 | 5 votes |
/** * @deprecated Use {@link #setItemAnimator(ItemAnimator)} ()}. */ @Deprecated @Override public void setLayoutTransition(LayoutTransition transition) { if (transition == null) { super.setLayoutTransition(null); } else { throw new IllegalArgumentException("Providing a LayoutTransition into RecyclerView is " + "not supported. Please use setItemAnimator() instead for animating changes " + "to the items in this RecyclerView"); } }
Example #29
Source File: IrrLayout.java From integrated-rating-request with MIT License | 5 votes |
public IrrLayout(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); if (attrs != null) { // default layout attrs TypedArray defAttrs = context.obtainStyledAttributes(attrs, DEFAULT_ATTRS); if (defAttrs != null) { // enable layout transition to provide nice effects out of the box boolean animateLayoutChanges = defAttrs.getBoolean(0, true); if (animateLayoutChanges) setLayoutTransition(new LayoutTransition()); defAttrs.recycle(); } // custom view attributes TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.IrrLayout); if (ta != null) { mRatingUrl = ta.getString(R.styleable.IrrLayout_ratingUrl); mFeedbackUrl = ta.getString(R.styleable.IrrLayout_feedbackUrl); // set default listener if at least one of rating or feedback url was given if (mRatingUrl != null || mFeedbackUrl != null) { mActionListener = new DefaultOnUserActionListener(mRatingUrl, mFeedbackUrl); } // check if user wants to use a custom rule engine mUseCustomEngine = ta.getBoolean(R.styleable.IrrLayout_useCustomRuleEngine, false); // .. if not, we use the default engine provided by the library if (!mUseCustomEngine) setupDefaultRuleEngine(context, ta); ta.recycle(); } } mVisibilityListener = new DefaultOnToggleVisibilityListener(); }
Example #30
Source File: AccordionView.java From Android_accordion_view with MIT License | 5 votes |
/*** * This function; after initializing the accordion, performs necessary UI operations like setting the partition or adding animation or * expanding or collapsing the accordion * @param context */ private void prepareLayout(Context context) { initializeViews(context); partition.setVisibility(isPartitioned ? VISIBLE : INVISIBLE); heading.setText(headingString); heading.setTextSize(headingTextSize); //Set the background on the heading...if the background drawable has been set by the user, use that. Else, set the background color if(!WidgetHelper.isNullOrBlank(headingBackground) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) headingLayout.setBackground(headingBackground); else if(!WidgetHelper.isNullOrBlank(headingBackgroundColor)) headingLayout.setBackgroundColor(headingBackgroundColor); //Set the background on the paragraph...if the background drawable has been set by the user, use that. Else, set the background color if(!WidgetHelper.isNullOrBlank(paragraphBackground) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) paragraph.setBackground(paragraphBackground); else if(!WidgetHelper.isNullOrBlank(paragraphBackgroundColor)) paragraph.setBackgroundColor(paragraphBackgroundColor); paragraph.setVisibility(VISIBLE); //paragraph.getViewTreeObserver().addOnGlobalLayoutListener(globalLayoutListener); if (isAnimated) { headingLayout.setLayoutTransition(new LayoutTransition()); } else { headingLayout.setLayoutTransition(null); } if (isExpanded) expand(); else collapse(); setOnClickListenerOnHeading(); }