我有这样动画上查看
视图当用户点击喜欢说“奥迪”的任何按钮。
我想要的是看到前面的这个观点与动画像
我已经试过被
我做一个布局是这样的(只是为了测试动画)
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:id="@+id/hideLayout"
android:layout_width="200dip"
android:layout_height="wrap_content"
android:layout_above="@+id/buttonLayout"
android:background="#f0f"
android:visibility="gone" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
</LinearLayout>
<LinearLayout
android:id="@+id/buttonLayout"
android:layout_width="200dip"
android:layout_height="wrap_content" >
<Button
android:id="@+id/btn_showView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Show View" />
</LinearLayout>
,然后让动画像
Animation showView=(Button)findViewById(R.id.btn_showView);
和我的动画文件
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<translate
android:duration="300"
android:fromYDelta="100%p"
android:toYDelta="0" />
</set>
然后
showView=(Button)findViewById(R.id.btn_showView);
showView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
hideLayout.startAnimation(animShow);
animShow.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
hideLayout.setVisibility(View.VISIBLE);
}
@Override
public void onAnimationRepeat(Animation animation) {
// TODO Auto-generated method stub
}
@Override
public void onAnimationEnd(Animation animation) {
hideLayout.setVisibility(View.VISIBLE);
}
});
}
});
这是工作,但不是我多么希望。 text View
来自底部。我希望我的形象展现出我想要的。
在此先感谢。
试试这个android:fromYDelta =“ - 100%p”代替android:fromYDelta =“100%p” – blessenm 2012-08-09 09:17:30
不,它会从屏幕的-ve底部开始。 – 2012-08-09 09:21:12
@MMohsinNaeem你有任何解决方案? – 2012-08-14 16:51:35