空视图以在其上添加任何内容
我正在创建一个应用程序,它有一个按钮可以切换 itens 的透视图(coverflow、网格和列表)。我的问题是,如何在活动中保留空间来交换这些视图?
我有一个页眉和一个页脚,中间我想在其中放置一个空视图以切换我对它的视角。
有人有更好的主意吗?
I'm creating an application and it's has a button to switch perspective view of the itens (coverflow, grid and list). My question was, how do I keep an space in my activity to swap these views?
I have a header, and a footer, the middle I want to place an empty View in that to switch my perspectives on it.
Someone has a better idea?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果我理解正确的话,你应该使用 ViewFlipper 之类的东西。更好的是,您可以将您的子视图定义为 includes 或 存根
You should use something like ViewFlipper if I understand you right. Even better you can define your children Views as includes or stubs
我不太明白你的问题。
您在寻找 ViewStub 吗?
http://developer.android.com/reference/android/view/ViewStub.html
您可以将布局膨胀到 ViewStub。但您可以对任何“ViewGroup”(如 LinearLayout 等)执行此操作。
优点是“ViewStub 是一个不可见的、零大小的视图,可用于在运行时延迟扩展布局资源”。它真的就在那里。
膨胀“正常”布局可能会产生额外成本。
I didn't really understand your question.
Are you looking for a ViewStub?
http://developer.android.com/reference/android/view/ViewStub.html
You can inflate layouts to a ViewStub. But you can do it to any "ViewGroup" like LinearLayout etc.
The advantage is that a "ViewStub is an invisible, zero-sized View that can be used to lazily inflate layout resources at runtime". It's really there for it.
Inflating "normal" layouts may have additional costs.