HirayClay / StackLayoutManager

:neckbeard:customized layoutmanager,let item pile up like stackview/类似最美有物卡片堆叠效果
452 stars 64 forks source link

java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first. #6

Open raj123456789123456789 opened 6 years ago

raj123456789123456789 commented 6 years ago

Hi your layout manager is very good however i'm getting this error in private int fill(RecyclerView.Recycler recycler, int dy, boolean apply) { int delta = direction.layoutDirection dy; // multiply the parallex factor if (apply) delta = (int) (delta parallex); if (direction == LEFT) return fillFromLeft(recycler, delta); if (direction == RIGHT)

        return fillFromRight(recycler, delta);
    if (direction == TOP)
        return fillFromTop(recycler, delta);
    else return dy;
}
HirayClay commented 6 years ago

i can't reproduce this error. how did you find this error? just run the apk and that happened? it is sad , i will try to help

raj123456789123456789 commented 6 years ago

Actually the error doesn't occur at first run I'm using this inside a fragment and when I switch tab and come back again and click on any of its item I start a new activity and when I come back from that activity and then when I click on any of its items it is giving me this error. Do you have any suggestions on how I could eliminate this error..

On Tue 19 Jun, 2018 6:18 am HirayClay, notifications@github.com wrote:

i can't reproduce this error. how did you find this error? just run the apk and that happened? it is sad , i will try to help

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/HirayClay/StackLayoutManager/issues/6#issuecomment-398239458, or mute the thread https://github.com/notifications/unsubscribe-auth/AjorBCEmRlPLV9AiGFaxT_yF3VZw5qQIks5t-EpegaJpZM4Urjxd .

HirayClay commented 6 years ago

of course ,you can add a defensive if statement “if (view.getParent() == null) addView(view)” in fillFromLeft fillFromTop fillFromRight these three methods. ifstatement It is a 'shameless' workaround util i find why.Another truth—— I am a noob in android and this layout manager kind of sucks when you dig deep into RecyclerView:neckbeard:

raj123456789123456789 commented 6 years ago

I think you are a great developer because your layout manger has helped me a lot