如何在点击的ListView复选框做出按钮栏下滑的底部? [英] How to make a buttons bar slide in from bottom upon clicking checkbox in ListView?

查看:79
本文介绍了如何在点击的ListView复选框做出按钮栏下滑的底部?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个自定义的listadapter,其中填充有一个复选框和一些textviews列表视图列表视图。当用户选择一个复选框,我需要一个按钮栏滑动到从屏幕底部的视图,并坐在那里。我已按钮杆,并且可以使其出现,并通过改变它的可见性水涨船高和可见,但它不与滑入和滑出效果做这些从屏幕上消失。我如何让它做这些动画??

I have a listview with custom listadapter, which populates the listview with a checkbox and some textviews. When the user selects a checkbox, I need a button bar to slide into the view from the bottom of the screen and sit there. I have made the buttons-bar and can make it appear and disappear from screen by changing it's visibility to "gone" and "visible", but it does not do these with slide-in and slide-out effect. How do I make it do those animations??

推荐答案

您想使用动画XML资源的。

下面是一个动画XML的一个例子,将幻灯片的对象从屏幕到永远取而代之的是你的布局中底:

Here is an example of an Animation xml that will 'slide' the object up from the bottom of the screen to where ever its place is within your layout:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <translate android:fromYDelta="100%p" android:toYDelta="0%p" android:duration="300"/>
</set>

您把在你的RES /阿尼姆的文件夹,然后使用这个Java code到动画的看法:

You will put that in your res/anim folder then use this java code to animate your view:

slideUpIn = AnimationUtils.loadAnimation(this, R.anim.slide_up_in);
yourButtonBarView.startAnimation(slideUpIn);

您会希望把你在哪里得到你的复选框被选中回调内部的startAnimation电话。

You'll want to put the startAnimation call inside where you get the callback that your CheckBox has been checked.

这篇关于如何在点击的ListView复选框做出按钮栏下滑的底部?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆