我想在一个activity中向下滑动android中的Relative布局。 我有以下功能滑下布局:在android中引用ViewGroup
public void setLayoutAnim_slidedown(ViewGroup panel, Context ctx) {
AnimationSet set = new AnimationSet(true);
Animation animation = new TranslateAnimation(
Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,
0.0f, Animation.RELATIVE_TO_SELF, -1.0f,
Animation.RELATIVE_TO_SELF, 0.0f);
animation.setDuration(800);
animation.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
// TODO Auto-generated method stub
// MapContacts.this.mapviewgroup.setVisibility(View.VISIBLE);
}
@Override
public void onAnimationRepeat(Animation animation) {
// TODO Auto-generated method stub
}
@Override
public void onAnimationEnd(Animation animation) {
// TODO Auto-generated method stub
}
});
set.addAnimation(animation);
LayoutAnimationController controller = new LayoutAnimationController(
set, 0.25f);
panel.setLayoutAnimation(controller);
}
当你看到第一行中的一个参数的类型的ViewGroup ..My问题是我怎么能引用视图组...
注意我试过以下
LayoutInflater inflater = (LayoutInflater) myContext
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = inflater.inflate(R.layout.childView, null);
但是,这返回查看不是groupView!
可以随时查看类型转换到一个ViewGroup作为一个ViewGroup是超一流的。 – 2012-04-26 09:16:46
另一个问题...我是否必须做比调用函数更多的东西......因为动画不是以这种方式开始的......有什么遗漏吗? – Developer 2012-04-26 09:32:24