如何在 Android 中从一种布局切换到另一种布局
我的想法是,当我打开应用程序时,带有进度条(确定)的布局将显示 5 秒。 5 秒后,此布局将被另一个包含一些按钮的布局替换。 如何做到这一点。请帮帮我...
My thinking is a layout with a progressBar( determinate ) will be shown for 5 second when i open my app. After 5sec this layout will be replaced by another layout containing some buttons.
How to do that. Plz help me...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以在 ViewFlipper 下的一个布局中定义所有两个布局属性,
然后在您的 java 程序中创建一个 ViewFlipper 对象。
并且调用
您还可以应用看起来从右到左切换布局的动画。谢谢...
You can define all of the two layouts properties inside one layout under ViewFlipper
Then in your java program create a ViewFlipper object.
And call
You can also apply animation that seems switching layouts from right to left. Thanks...
尝试
setContentView(R.layout.secondLayout);
如果这不起作用,您还可以将所有视图放在一个布局下,并将按钮的可见性设置为 true,将进度条的可见性设置为5 秒后为假。
Try
setContentView(R.layout.secondLayout);
If that didn't work, you could also put all your views under one layout and set the visibility of the buttons to true and the visibility of the progressbar to false after 5 seconds.
您可以使用 ViewAnimator
You can use ViewAnimator
在 LinearLayout 或相对布局中,如果您为进度条和第二个包含按钮声明两个布局,那么当进度条进度完成时,只需将进度条布局可见性设置为 GONE,将按钮布局可见性设置为 VISIBLE。
首先按钮布局的可见性应该消失。
In a LinearLayout or relative layout if you declare two layouts layouts for progess bar and second containing buttons then when progress bar progress is completed just set progress bar layout visibility as GONE and buttons layout visibility as VISIBLE.
At first buttons layout visibility should GONE.