简体   繁体   English

您如何进行动态布局?

[英]How do you do your dynamic layouts?

I want to dynamically hide/show controls in an activity based on a button touch event: when the user presses the "details" button, I want to show more controls in the same activity. 我想基于按钮触摸事件动态隐藏/显示活动中的控件:当用户按下“详细信息”按钮时,我想在同一活动中显示更多控件。

What is the best way to handle this? 处理此问题的最佳方法是什么? Is there a way to do TextView.Hide() ? 有没有办法做TextView.Hide() Can it animate the transition? 可以为过渡设置动画吗?

setVisibility() will allow you to make a widget visible, invisible, or gone. setVisibility()将使您可以使窗口小部件可见,不可见或不可见。 The difference between the latter two is that an invisible widget still takes up space, while a widget that is gone does not. 后两者的区别在于,不可见的小部件仍会占用空间,而消失的小部件则不会占用空间。

Android has an entire animation framework for slides, fades, spins, and the like. Android具有用于幻灯片,淡入淡出,旋转等的完整动画框架 Here are two sample projects showing some of this. 这是两个示例项目,显示了其中的一些内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM