单击图像按钮打开滑块
我有一些问题
这是我的 Android 版本的页脚栏,当我点击 i 时按钮然后滑块栏应该用另一个按钮打开,例如
我如何在 android 中执行此操作
我已经尝试过一些使用警报对话框工作,但它不起作用
任何人都知道我该怎么做,
任何帮助将不胜感激。
i have some problem
this the footer bar of my android build now when i want that when i click on i button then slider bar should be open with another buttons like
how can i do this in android
i have try some work using alert dialog but its not working
any one have idea how can i do that
any help would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
执行此类操作的一种方法是拥有一个包含要显示或隐藏的按钮行的布局。然后,您可以使用 OnClickListener 设置按钮单击以显示或隐藏布局。因此,在 Activity 中类似这样的东西可以工作:
简单的示例布局 main.xml 可能看起来有点像这样:
如果您还需要在可见性发生变化时为按钮行设置动画,您可能应该查看 动画资源。
One way to do something like this is to have a layout that contains the row of buttons you want to show or hide. You can then use an OnClickListener to set the button clicks to show or hide the layout. So something like this in the Activity could work:
And the simple example layout main.xml could look a bit like this:
If you also need to animate the button row when the visibility changes, you should probably look into animation resources.
您首先应该在动画文件夹中有一个slide_right_in.xml:
和slide_right_out.xml:
在您的情况下,您需要左进右出动画,因此您应该根据需要更改上面的代码。
然后在动画对象中加载动画,然后在上面的答案中设置可见性之前启动它:
you should first have a slide_right_in.xml in your anim folder:
and slide_right_out.xml:
in your case you need left in and out animation so you should change above code as per need.
and then load animation in a animation object, then start it just before of setting visibility in above answer: