0
キャプチャボタンをクリックしたときにfadeIn-fadeOutのようなアニメーションを作りたいと思います。 animatedViewでandroid:fromAlpha = "1.0"、android:toAlpha = "0.0"と設定した場合は動作しますが、逆にする必要があります。 ここに私のレイアウト:アニメーションalpha(SurfaceViewの下)が動作しない
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<SurfaceView
android:id="@+id/preview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<View
android:id="@+id/animated_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black"
android:alpha="0.0"/>
<Button
android:id="@+id/button_capture"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true" />
</RelativeLayout>
ここに私のアニメーションのxml:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_interpolator">
<alpha
android:duration="500"
android:fromAlpha="0.0"
android:repeatCount="1"
android:repeatMode="reverse"
android:toAlpha="1.0"
/>
</set>
そして、それは私がそれを実行する方法は次のとおりです。
animClick = AnimationUtils.loadAnimation(getApplicationContext(),
R.anim.click);
@OnClick(R.id.button_capture)
void onCaptureClick() {
camera.takePicture(null, null, jpegCallback);
animatedView.startAnimation(animClick);
}
、何が私が間違ってやっている、どうなりますか?
しかし、私はViewを完全にオーバーラップSurfaceView – Nikita
あなたは更新された答えをチェックするかもしれませんこのxmlファイルを使用してください –