ViewStub vs. View.GONE

后端 未结 1 615

As far as I undestand, neither a ViewStub nor a View that\'s GONE participate in the measure and layout passes (or rendering anyway).

Is there

1条回答
  •  难免孤独
    2021-02-19 01:11

    The rendering performance comes into picture when you are inflating the views.

    My guess is that its much cheaper to inflate a ViewStub than to inflate a View, either from XML or by changing visibility. ViewStub is especially used when you need to add/remove (indefinite) views (eg. add phone numbers to a given contact). Hope this is what you were looking for.

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