ListViewDraggingAnimation broken on Android 5 Lollipop

后端 未结 4 673
無奈伤痛
無奈伤痛 2020-12-14 01:01

I\'m using ListViewDraggingAnimation by DevBytes, but it seems broken on Android Lollipop developer preview 2 (LPX13D). When I drag a row over other rows, those rows will di

4条回答
  •  猫巷女王i
    2020-12-14 01:48

    To be honest, I don't what causes the problem, but this fix makes no visual errors anymore on any version. And because all that was changed is just visibility of view, I believe it shouldn't create any new functional problems.


    Replace this code in function handleCellSwitch() in class DynamicListView:

    mobileView.setVisibility(View.VISIBLE);
    switchView.setVisibility(View.INVISIBLE);
    

    for

    if (android.os.Build.VERSION.SDK_INT <= android.os.Build.VERSION_CODES.KITKAT){
        mobileView.setVisibility(View.VISIBLE);
        switchView.setVisibility(View.INVISIBLE);
    } else{
        mobileView.setVisibility(View.INVISIBLE);
        switchView.setVisibility(View.VISIBLE);
    }
    

    I tried tinkering with the code and in the end I found a way how to make it display as it was before. But fixing the problem for Lollipop made the same problem appear on KitKat and previous versions instead. So I applied the fix only for android versions higher than KitKat.

    My guess is that these two views gets exchanged in the process for some reason on the new Lollipop version. In effect, one of the views gets always displayed while the other one gets always hidden. Would be nice to know where and what was changed in the lollipop android code though...

提交回复
热议问题