我有這樣動畫上查看
視圖當用戶點擊喜歡說「奧迪」的任何按鈕。
我想要的是看到前面的這個觀點與動畫像
我已經試過被
我做一個佈局是這樣的(只是爲了測試動畫)
<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