devendroid / ReadMoreOption

Convert your TextView in ExpandableTextView with added options ReadMore/ReadLess.
Apache License 2.0
207 stars 38 forks source link

Add Slide Animation #2

Closed wezley98 closed 6 years ago

wezley98 commented 6 years ago

Is it possible to add a slide animation when the user clicks on the textview?

devendroid commented 6 years ago

Use like this, TextView will expand with animation:

  ```
    @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);
        }

        TextView textView = (TextView) view.findViewById(R.id.tv);
        ReadMoreOption readMoreOption = new ReadMoreOption.Builder(getActivity()).build();
        readMoreOption.addReadMoreTo(textView, "Your long text..");

    }
devendroid commented 6 years ago

Now this is taken care by the library in version 1.0.1 , You can expand text with animation using just enable this option: .expandAnimation(true) But also have a look known issues for some limitations.