Having a problem removing TextViews from a LinearLayout programmatically

后端 未结 1 1218
南方客
南方客 2020-12-16 16:31

I am programmatically adding TextViews to a LinearLayout, and deleting them on touch. It all works fine except when the last TextView is touched it doesn\'t get removed. If

1条回答
  •  轮回少年
    2020-12-16 17:17

    This sounds more of a bug in Android, but one thing you could try is hiding your TextView before removal:

    tv1.setVisibility(View.GONE)
    

    Or alternatively you could add:

    linearlayout1.invalidate()
    

    after removal of the last item to trigger redrawing.

    0 讨论(0)
提交回复
热议问题