Commit b8eff319 by 韩飞虎

动画效果搞定了

parent 11a14519
package com.example.blu.toys.activity;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import androidx.annotation.RequiresApi;
import androidx.appcompat.widget.AppCompatImageView;
import com.clj.fastble.data.BleDevice;
import com.example.blu.toys.R;
......@@ -16,12 +20,22 @@ import org.greenrobot.eventbus.ThreadMode;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
public class SearchingActivity extends BaseActivity {
@BindView(R.id.iv_beecartoon)
ImageView ivBeecartoon;
@BindView(R.id.go_search_ble)
AppCompatImageView goSearchBle;
@BindView(R.id.go_search_ble_1)
AppCompatImageView goSearchBle1;
@BindView(R.id.go_search_ble_2)
AppCompatImageView goSearchBle2;
@Override
public int getLayout() {
return R.layout.activity_searching;
......@@ -50,7 +64,31 @@ public class SearchingActivity extends BaseActivity {
}
@Override
public void onBackPressed() {
finish();
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// TODO: add setContentView(...) invocation
ButterKnife.bind(this);
Animation animation = AnimationUtils.loadAnimation(this, R.anim.translate_anim);
ivBeecartoon.startAnimation(animation);
goSearchBle.setImageDrawable(this.getResources().getDrawable(R.drawable.search_bg));
Animation animation1 = AnimationUtils.loadAnimation(this, R.anim.search_anim);
goSearchBle.startAnimation(animation1);
new Handler().postDelayed(new Runnable() {
public void run() {
Animation animation2 = AnimationUtils.loadAnimation(SearchingActivity.this, R.anim.search_anim);
goSearchBle1.setImageDrawable(SearchingActivity.this.getResources().getDrawable(R.drawable.search_bg));
goSearchBle1.startAnimation(animation2);
}
}, 700);
new Handler().postDelayed(new Runnable() {
public void run() {
Animation animation3 = AnimationUtils.loadAnimation(SearchingActivity.this, R.anim.search_anim);
goSearchBle2.setImageDrawable(SearchingActivity.this.getResources().getDrawable(R.drawable.search_bg));
goSearchBle2.startAnimation(animation3);
}
}, 1400);
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<cycleInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
android:cycles="2" />
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<scale
android:duration="2100"
android:fromXScale="1.0"
android:fromYScale="1.0"
android:pivotX="50%"
android:pivotY="50%"
android:toXScale="2.5"
android:toYScale="2.5"
android:repeatCount="infinite"/>
<alpha
android:duration="2100"
android:fromAlpha="1.0"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:toAlpha="0.4"
android:repeatCount="infinite"/>
</set>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="1000"
android:fromYDelta="0"
android:interpolator="@anim/cycle"
android:toYDelta="10"
android:repeatCount="infinite">
</translate>
\ No newline at end of file
......@@ -63,6 +63,28 @@
android:layout_gravity="center"
android:orientation="vertical">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/go_search_ble_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/go_search_ble_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/go_search_ble"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:src="@mipmap/searchrings" />
<LinearLayout
android:layout_width="wrap_content"
......@@ -89,24 +111,18 @@
</LinearLayout>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/go_search_ble"
<ImageView
android:id="@+id/iv_beecartoon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:src="@mipmap/searchrings" />
android:layout_alignParentRight="true"
android:layout_marginEnd="@dimen/dp_60"
android:layout_marginTop="@dimen/dp_80"
android:src="@mipmap/beecartoon" />
</RelativeLayout>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/animate"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/dp_14"
android:src="@mipmap/beecartoon" />
</RelativeLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment