ChadCSong / ShineButton

This is a UI lib for Android. Effects like shining.
MIT License
4.22k stars 544 forks source link

In fragment don't work the explosion in the icon #24

Open salveta opened 7 years ago

salveta commented 7 years ago

Hi,

I'm trying to implement the library. The icon change the color and do the effect of the moviment, but is not working inside a fragment. If I copy the same code in an activity, it is working fine.

Have the library a problem working in a fragment?

Fragment code: @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState);

    shineButton = (ShineButton) getView().findViewById(R.id.po_image0);
    shineButton.init((HomeActivity)getActivity());

    shineButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
        }
    });

}

XML code: <com.sackcentury.shinebuttonlib.ShineButton android:id="@+id/po_image0" android:layout_width="18dp" android:layout_height="18dp" app:btn_color="@color/colorGrey" app:btn_fill_color="#f26d7d" app:siShape="@raw/ico_social_like" android:layout_marginTop="@dimen/margin_10" android:layout_marginLeft="@dimen/margin_20" android:layout_marginStart="@dimen/margin_20" android:elevation="10dp"/>

ChadCSong commented 7 years ago

I just update a fragment example https://github.com/ChadCSong/ShineButton/blob/master/app/src/main/java/com/sackcentury/shinebutton/FragmentDemo.java I haven't replication your problem.