2023年7月7日发(作者:)
Android组件ViewStub基本使⽤⽅法详解ViewStub可以在运⾏时动态的添加布局。帮助⽂档给定的定义是:"A ViewStub is an invisible, zero-sized View that can be used to lazily inflate layout resources at runtime. When a ViewStubis made visible, or when inflate() is invoked, the layout resource is inflated. The ViewStub then replaces itself in its parentwith the inflated View or Views. Therefore, the ViewStub exists in the view hierarchy until setVisibility(int) or inflate() isinvoked. The inflated View is added to the ViewStub's parent with the ViewStub's layout parameters. Similarly, you candefine/override the inflate View's id by using the ViewStub's inflatedId property.”总之是:ViewStub可以给其他的view事先占据好位置,当需要的时候调⽤inflater()或者是setVisible()⽅法显⽰这些View组件。:
:
发布者:admin,转转请注明出处:http://www.yc00.com/news/1688676832a161745.html
评论列表(0条)