안 드 로 이 드 모방 위 챗 레이더 복사 검색 친구(논리 선명 실현 간단)
테스트 기 가 사람 을 보 냈 습 니 다.그 동안 시 뮬 레이 터 로 계속 표시 해 야 겠 죠?
위 챗 레이더 스 캔 을 모방 하여 안 탁 위 챗,클 라 우 드 레이더 스 캔 애니메이션 효 과 를 모방 하여 중간 에 있 는 검은색 원 을 클릭 하여 애니메이션 을 스 캔 하기 시 작 했 습 니 다.다시 리 셋 을 클릭 하면 이런 효과 가 필요 한 친 구 는 스스로 다운로드 하여 볼 수 있 습 니 다.
효과 도 는 다음 과 같다.
이 화면 은 모두 가 알 고 있다 고 믿는다.우리 가 원 리 를 말 해 보 자.사실은 3 층 이다.
중간 에 한 장의 그림 이 있 고 그 다음 에 네 개의 원 을 그 려 야 합 니 다.이것 은 간단 하 겠 죠?아 닙 니 다.안 드 로 이 드 그래 픽 메커니즘(2)-사용자 정의 View 그래 픽,원형,삼각형,부채 형,타원,곡선,문자 와 그림 의 좌표 설명 을 볼 수 있 습 니 다.그리고 맨 위 에 그 라 데 이 션 원 이 있 습 니 다.이 원 은 우리 가 그 를 끊임없이 회전 시 키 기만 하면 됩 니 다.그럼 우 리 는 새로운 프로젝트 인 Radar Search 를 만 듭 시다.
layou_main.xml
<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"
android:background="@drawable/photo" >
<com.lgl.radarsearch.RadarView
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@drawable/circle_photo" />
</RelativeLayout>
RadarView 를 새로 만 듭 니 다.
RadarView
package com.lgl.radarsearch;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.graphics.Shader;
import android.graphics.SweepGradient;
import android.os.Handler;
import android.util.AttributeSet;
import android.view.View;
/**
*
*
* @author LGL
*
*/
public class RadarView extends View {
/**
* : , , onMeasure() , onDraw() ,
* Matrix
*/
private Paint mPaintLine, mPaintCircle;
private int w, h;
//
private Matrix matrix;
//
private int start;
// Handler
private Handler handler = new Handler();
private Runnable run = new Runnable() {
@Override
public void run() {
start = start + 1;
matrix = new Matrix();
// : , x,y
matrix.postRotate(start, w / 2, h / 2);
//
RadarView.this.invalidate();
//
handler.postDelayed(run, 60);
}
};
public RadarView(Context context, AttributeSet attrs) {
super(context, attrs);
initView();
//
w = context.getResources().getDisplayMetrics().widthPixels;
h = context.getResources().getDisplayMetrics().heightPixels;
//
handler.post(run);
}
private void initView() {
mPaintLine = new Paint();
mPaintLine.setColor(Color.WHITE);
mPaintLine.setAntiAlias(true);
mPaintLine.setStyle(Style.STROKE);
mPaintCircle = new Paint();
mPaintCircle.setColor(Color.RED);
mPaintCircle.setAntiAlias(true);
matrix = new Matrix();
}
/**
*
*
* @author LGL
*/
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
//
setMeasuredDimension(w, h);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
//
canvas.drawCircle(w / 2, h / 2, w / 2, mPaintLine);
canvas.drawCircle(w / 2, h / 2, w / 3, mPaintLine);
canvas.drawCircle(w / 2, h / 2, w * 7 / 10, mPaintLine);
canvas.drawCircle(w / 2, h / 2, w / 4, mPaintLine);
//
Shader mShader = new SweepGradient(w / 2, h / 2, Color.TRANSPARENT,
Color.parseColor("#AAAAAAAA"));
//
mPaintCircle.setShader(mShader);
// ,
canvas.concat(matrix); //
canvas.drawCircle(w / 2, h / 2, w * 7 / 10, mPaintCircle);
}
}
위 에서 말 한 것 은 소 편 이 소개 한 안 드 로 이 드 모방 위 챗 레이더 복사 검색 친구(논리 가 뚜렷 하고 간단 함)에 관 한 지식 으로 도움 이 되 기 를 바 랍 니 다.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Kotlin의 기초 - 2부지난 글에서는 Kotlin이 무엇인지, Kotlin의 특징, Kotlin에서 변수 및 데이터 유형을 선언하는 방법과 같은 Kotlin의 기본 개념에 대해 배웠습니다. 유형 변환은 데이터 변수의 한 유형을 다른 데이터...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.