Smooth text change in android animation

前端 未结 7 2018
刺人心
刺人心 2020-12-11 00:29

I want to add animation in android text view so that when a text changes it should change smoothly and slowly. Like, fade in or fade out when the text changes. Is it possibl

7条回答
  •  抹茶落季
    2020-12-11 00:51

    Use this in onCreate() , before change text in your textview:

        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            LinearLayout parentLayout = (LinearLayout)view.findViewById(R.id.container);
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
                LayoutTransition layoutTransition = new LayoutTransition();
                layoutTransition.enableTransitionType(LayoutTransition.CHANGING);
                parentLayout.setLayoutTransition(layoutTransition);
            }    
            ......    
        }
    

提交回复
热议问题