当前位置: 首页 > article >正文

Android 旋转盘导航栏

1.直接上源码:

package com.you.arc;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.RectF;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.widget.FrameLayout;

public class ArcFramelayout extends FrameLayout {
    private final String TAG = "ArcFramelayout";
    private Paint redPaint = new Paint();
    private Paint bluePaint = new Paint();
    private Paint greenPaint = new Paint();

    private boolean isLayout;
    private float[] srcDegreesArr = null;
    private float[] moveDegreesArr = null;
    private float defaultDegrees;
    private float minGapDg = 360f;
    private final int DEFAULT_INDEX = 2;

    private OnArcItemListener onItemSelectedListener;

    public void setOnArcItemListener(OnArcItemListener onItemSelectedListener) {
        this.onItemSelectedListener = onItemSelectedListener;
    }

    public interface OnArcItemListener {
        void onItemSelected(int pos);

        void onItemClick(int viewId);
    }

    public ArcFramelayout(Context context) {
        this(context, null);
    }

    public ArcFramelayout(Context context, @Nullable AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public ArcFramelayout(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        redPaint.setColor(Color.RED);
        redPaint.setStyle(Paint.Style.FILL_AND_STROKE);
        redPaint.setAntiAlias(true);

        bluePaint.setColor(Color.BLUE);
        bluePaint.setStyle(Paint.Style.FILL_AND_STROKE);
        bluePaint.setAntiAlias(true);

        greenPaint.setColor(Color.GREEN);
        greenPaint.setStyle(Paint.Style.FILL_AND_STROKE);
        greenPaint.setAntiAlias(true);
        greenPaint.setStrokeWidth(9);

    }

    private float mDx, mDy, sweepAngle;//按下坐标值
    private int action;

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        this.action = event.getAction();

        switch (event.getAction()) {
            case MotionEvent.ACTION_DOWN:
                mDx = event.getX();
                mDy = event.getY();
                Log.i(TAG, "down=mDx=" + mDx + ",mDy=" + mDy);
                break;
            case MotionEvent.ACTION_MOVE:
                float mx = event.getX();
                float my = event.getY();

                float disW = mx - mDx;//x轴滑动距离
                float disH = my - mDy;//y轴滑动距离
                if (!isLayout) {
                    if (Math.abs(disW) > Math.abs(disH)) {//滑动轴判断(这个条件可根据实际需求判断)
                        if (disW > 0) {//往右滑
                            touchHandle(mDy < oval.centerY());
                            Log.i(TAG, "move=往右滑=mDx=" + mDx + ",mDy=" + mDy + ",mx=" + mx + ",my=" + my + ",disW=" + disW + ",disH=" + disH);
                        } else {//往左滑
                            touchHandle(mDy > oval.centerY());
                            Log.i(TAG, "move=往左滑=mDx=" + mDx + ",mDy=" + mDy + ",mx=" + mx + ",my=" + my + ",disW=" + disW + ",disH=" + disH);
                        }
                    } else {
                        if (disH > 0) {//往下滑
                            touchHandle(mDx > oval.centerX());
                            Log.i(TAG, "move=往下滑=mDx=" + mDx + ",mDy=" + mDy + ",mx=" + mx + ",my=" + my + ",disW=" + disW + ",disH=" + disH);
                        } else {//往上滑
                            touchHandle(mDx < oval.centerX());
                            Log.i(TAG, "move=往上滑=mDx=" + mDx + ",mDy=" + mDy + ",mx=" + mx + ",my=" + my + ",disW=" + disW + ",disH=" + disH);
                        }
                    }
                }
                mDx = mx;//替换x轴坐标值
                mDy = my;//替换y轴坐标值

                break;
            case MotionEvent.ACTION_UP:
//                updateSelected();
                break;
        }
        return true;
    }

    private void updateSelected() {
        isLayout = true;
        float srcDg = srcDegreesArr[DEFAULT_INDEX];
        float moveDg = moveDegreesArr[selectIndex];
        float diffDg = moveDg > srcDg ? moveDg - srcDg : srcDg - moveDg;
        Log.i(TAG, "updateSelected-srcDg=" + srcDg + ",moveDg=" + moveDg + ",diffDg=" + diffDg);
        for (int i = 0; i < moveDegreesArr.length; i++) {
//            moveDegreesArr[i] = moveDg > srcDg ? moveDegreesArr[i] - diffDg : moveDegreesArr[i] + diffDg;
        }

        requestLayout();
    }



    private void touchHandle(boolean isAdd) {
        isLayout=true;
        rotate(isAdd);
    }
    private void touchHandle(boolean isAdd, float dis, boolean isRunAnim) {
        isLayout = true;

        if (!isRunAnim) {
            dis = Math.min(Math.abs(dis), 1.6f);
        }

        int childCount = getChildCount();
        for (int i = 0; i < childCount; i++) {
            float newDegrees = isAdd ? moveDegreesArr[i] + dis : moveDegreesArr[i] - dis;
            newDegrees = newDegrees > 360 ? newDegrees - 360 : newDegrees < 0 ? newDegrees + 360 : newDegrees;
            Log.i(TAG, "touchHandle-i=" + i + ",newDegrees=" + newDegrees);
            moveDegreesArr[i] = newDegrees;
        }

        /*int childCount = getChildCount();
        for (int i = 0; i < childCount; i++) {
            int nextIndex = i == childCount - 1 ? 0 : i + 1;
            float sdg = moveDegreesArr[nextIndex];
            float mdg = moveDegreesArr[i];

            float cwDiff = (sdg - mdg);
            cwDiff = cwDiff < 0 ? cwDiff + 360 : cwDiff;

            float ccwDiff = (mdg - sdg);
            ccwDiff = ccwDiff < 0 ? ccwDiff + 360 : ccwDiff;

            float diff = Math.min(cwDiff, ccwDiff);
            dis = (diff / 10f);

            float newDegrees = cwDiff < ccwDiff ? (mdg + dis) : (mdg - dis);
            newDegrees = newDegrees > 360 ? newDegrees - 360 : newDegrees < 0 ? newDegrees + 360 : newDegrees;

            moveDegreesArr[i] = newDegrees;
            Log.i(TAG, "touchHandle-i=" + i + ",cwDiff=" + cwDiff + ",ccwDiff="+ ccwDiff + ",dis=" + dis + ",degrees=" + mdg + ",newDegrees=" + newDegrees);
        }*/

        sweepAngle = isAdd ? sweepAngle + dis : sweepAngle - dis;
        sweepAngle = sweepAngle % 360f;
        Log.i(TAG, "touchHandle-isAdd=" + isAdd + ",dis=" + dis + ",sweepAngle=" + sweepAngle);

        requestLayout();
    }

    private float[] animDegreesArr = null;

    private void runAnim(boolean isAdd) {
        isLayout = true;

        int childCount = getChildCount();
        if (animDegreesArr == null) {
            animDegreesArr = new float[childCount];
            for (int i = 0; i < childCount; i++) {
                animDegreesArr[i] = moveDegreesArr[i];
            }
        }

        for (int i = 0; i < childCount; i++) {
            int nextIndex = isAdd ? (i == childCount - 1 ? 0 : i + 1) : (i == 0 ? childCount - 1 : i - 1);
            float sdg = animDegreesArr[nextIndex];
            float mdg = animDegreesArr[i];

            float cwDiff = (sdg - mdg);
            cwDiff = cwDiff < 0 ? cwDiff + 360 : cwDiff;

            float ccwDiff = (mdg - sdg);
            ccwDiff = ccwDiff < 0 ? ccwDiff + 360 : ccwDiff;

            float diff = isAdd ? cwDiff : ccwDiff;
            float dis = (diff / 10f);

            float newDegrees = isAdd ? (moveDegreesArr[i] + dis) : (moveDegreesArr[i] - dis);
            newDegrees = newDegrees > 360 ? newDegrees - 360 : newDegrees < 0 ? newDegrees + 360 : newDegrees;

            moveDegreesArr[i] = runCount==10 ? sdg : newDegrees;
            Log.i(TAG, "runAnim-i=" + i + ",cwDiff=" + cwDiff + ",ccwDiff=" + ccwDiff + ",dis=" + dis +",sdg=" + sdg + ",mdg=" + mdg + ",newDegrees=" + newDegrees);
        }

        requestLayout();
    }

    private boolean isCW = true;

    public void rotate(boolean isCW) {
        this.isCW=isCW;
        post(runnable);
    }

    private int runCount = 0;
    private Runnable runnable = new Runnable() {
        float mdg = -1;

        @Override
        public void run() {
            isLayout = true;
            runCount++;
            if (runCount <= 10) {
                /*float sdg = srcDegreesArr[DEFAULT_INDEX];
                if (mdg == -1) {
                    mdg = moveDegreesArr[clickIndex];
                }

                float cwDiff = (sdg - mdg);
                cwDiff = cwDiff < 0 ? cwDiff + 360 : cwDiff;

                float ccwDiff = mdg - sdg;
                ccwDiff = ccwDiff < 0 ? ccwDiff + 360 : ccwDiff;

                float diff = Math.min(cwDiff, ccwDiff);

                float rDg = (diff / 10f);
                touchHandle(cwDiff < ccwDiff, rDg, true);
                Log.i(TAG, "runnable-runCount=" + runCount + ",diff=" + diff + ",rDg=" + rDg + ",clickIndex=" + clickIndex + ",mdg=" + mdg + ",sdg=" + sdg);
                runAnim(cwDiff < ccwDiff);*/
                runAnim(isCW);
                Log.i(TAG, "runnable-runCount=" + runCount);
                postDelayed(this, 40);
            } else {
                animDegreesArr = null;
                runCount = 0;
                mdg = -1;
                isLayout = false;
            }
        }
    };

    private boolean checkDiret(int clickIndex) {
        float sdg = srcDegreesArr[DEFAULT_INDEX];
        float mdg = moveDegreesArr[clickIndex];

        float cwDiff = (sdg - mdg);
        cwDiff = cwDiff < 0 ? cwDiff + 360 : cwDiff;

        float ccwDiff = mdg - sdg;
        ccwDiff = ccwDiff < 0 ? ccwDiff + 360 : ccwDiff;
        return cwDiff < ccwDiff;
    }

    private int clickIndex;

    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();
        int childCount = getChildCount();
        srcDegreesArr = new float[childCount];
        moveDegreesArr = new float[childCount];
        for (int i = 0; i < childCount; i++) {
            View childView = getChildAt(i);

           /* childView.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View view) {
                    if (view.isSelected()) {
                        if (onItemSelectedListener != null) {
                            onItemSelectedListener.onItemClick(view.getId());
                        }
                    } else {
                        if (!isLayout) {
                            isLayout = true;
                            for (int j = 0; j < childCount; j++) {
                                float d = Float.valueOf(childView.getTag().toString());
                                if (d == srcDegreesArr[j]) {
                                    clickIndex = j;
                                    break;
                                }
                            }
                            isCW=checkDiret(clickIndex);
                            post(runnable);
                        }
                    }
                }
            });*/

            float degrees = Float.valueOf(childView.getTag().toString());

            int nextIndex = i == childCount - 1 ? 0 : i + 1;
            float nextDg = Float.valueOf(getChildAt(nextIndex).getTag().toString());
            float gapDg = (nextDg - degrees) < 0 ? (nextDg - degrees) + 360 : (nextDg - degrees);
            minGapDg = Math.min(gapDg, minGapDg);

            srcDegreesArr[i] = degrees;
            moveDegreesArr[i] = degrees;
            Log.i(TAG, "onFinishInflate-childCount=" + childCount + ",i=" + i + ",degrees=" + degrees + ",minGapDg=" + minGapDg);
        }
    }

    private boolean isContainDegrees(float moveDegrees) {
        float centerDg = srcDegreesArr[DEFAULT_INDEX];
        float preDg = srcDegreesArr[DEFAULT_INDEX == 0 ? srcDegreesArr.length - 1 : DEFAULT_INDEX - 1];
        float nextDg = srcDegreesArr[DEFAULT_INDEX == srcDegreesArr.length - 1 ? 0 : DEFAULT_INDEX + 1];
        float preHalfDg = (centerDg - preDg) < 0 ? 360 - (centerDg - preDg) : (centerDg - preDg);
        float nextHalfDg = (nextDg - centerDg) < 0 ? 360 - (nextDg - centerDg) : (nextDg - centerDg);

        float preCpDg = (centerDg - (preHalfDg * 0.5f)) < 0 ? 360f - (centerDg - (preHalfDg * 0.5f)) : (centerDg - (preHalfDg * 0.5f));
        float nextCpDg = (centerDg + (nextHalfDg * 0.5f)) > 360f ? (centerDg + nextHalfDg * 0.5f) - 360f : (centerDg + (nextHalfDg * 0.5f));

        Log.i(TAG, "isContainDegrees-moveDegrees=" + moveDegrees + ",centerDg=" + centerDg + ",preDg=" + preDg + ",nextDg=" + nextDg + ",preHalfDg=" + preHalfDg + ",nextHalfDg=" + nextHalfDg + ",preCpDg=" + preCpDg + ",nextCpDg=" + nextCpDg);
        return (moveDegrees >= preCpDg && moveDegrees < nextCpDg);
//        return (moveDegrees >= centerDg && moveDegrees <= nextDg);
    }

    private int vWidth;
    private int vHeight;
    private int selectIndex = DEFAULT_INDEX;

    @Override
    protected void onLayout(boolean changed, int l, int t, int r, int b) {
        isLayout = true;
        vWidth = getMeasuredWidth();
        vHeight = getMeasuredHeight();
        int childCount = getChildCount();
        Log.i(TAG, "onLayout-changed=" + changed + ",l=" + l + ",t=" + t + ",r=" + r + ",b=" + b + ",vWidth=" + vWidth + ",vHeight=" + vHeight + ",childCount=" + childCount + ",sweepAngle=" + sweepAngle);
        for (int i = 0; i < childCount; i++) {
            View childView = getChildAt(i);

            float degrees = moveDegreesArr[i];

            if (isContainDegrees(degrees)) {
                selectIndex = i;
            }
            Point endPoint = getEndPoint(oval.left, oval.top, oval.width(), oval.height(), 0, -degrees);
            int cvW = childView.getMeasuredWidth();
            int cvH = childView.getMeasuredHeight();
            Log.i(TAG, "onLayout-i=" + i + ",px=" + endPoint.x + ",py=" + endPoint.y + ",cvW=" + cvW + ",cvH=" + cvH + ",degrees=" + degrees);
            childView.layout((int) (endPoint.x - cvW * 0.5f), (int) (endPoint.y - cvH * 0.5f), (int) (endPoint.x + cvW * 0.5f), (int) (endPoint.y + cvH * 0.5f));
        }
        if (onItemSelectedListener != null) {
            onItemSelectedListener.onItemSelected(selectIndex);
        }
        isLayout = false;
    }

    private RectF oval = new RectF(-290, 65, 960, 525);

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        Log.i(TAG, "onDraw");
        Paint p = new Paint();
        p.setStrokeWidth(10);
        p.setColor(Color.RED);

        Paint p0 = new Paint();
        p0.setStrokeWidth(5);
        p0.setColor(Color.GREEN);

        Paint p1 = new Paint();
        p1.setColor(Color.parseColor("#808C8C8C"));

//        canvas.drawArc(oval.left, oval.top, oval.right, oval.bottom, 0, 360, true, p1);
//        canvas.drawLine(oval.left, oval.top + oval.height() / 2, oval.right, oval.top + oval.height() / 2, p);
//        canvas.drawLine(oval.left + oval.width() / 2f, oval.top, oval.left + oval.width() / 2f, oval.bottom, p);

        int childCount = getChildCount();
        for (int i = 0; i < childCount; i++) {
            View childView = getChildAt(i);
            float degrees = Float.valueOf(childView.getTag().toString());
            Point endPoint = getEndPoint(oval.left, oval.top, oval.width(), oval.height(), 0, -degrees);
            canvas.drawPoint(endPoint.x, endPoint.y, p0);
        }

        Point endPoint = getEndPoint(oval.left, oval.top, oval.width(), oval.height(), 0, -19);
        canvas.drawPoint(endPoint.x, endPoint.y, p);

    }

    private Point getEndPoint(float x, float y, float width, float height, float startAngle, float extentAngle) {
        double var1 = Math.toRadians(-startAngle - extentAngle);
        double var3 = x + (Math.cos(var1) * 0.5 + 0.5) * width;
        double var5 = y + (Math.sin(var1) * 0.5 + 0.5) * height;
        return new Point((int) var3, (int) var5);
    }

}

2.MainActivity

package com.you.arc;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.Toast;

//import java.awt.geom.Arc2D;//这个类里面有圆周运动计算公式

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

        ArcFramelayout arcFramelayout = findViewById(R.id.arc_framelayout);
        arcFramelayout.setOnArcItemListener(new ArcFramelayout.OnArcItemListener() {
            @Override
            public void onItemSelected(int pos) {
                for (int i = 0; i < arcFramelayout.getChildCount(); i++) {
                    if (i == pos) {
                        ViewGroup parent = ((ViewGroup) arcFramelayout.getChildAt(i));
                        parent.setSelected(true);
                        for (int j = 0; j < parent.getChildCount(); j++) {
                            parent.getChildAt(j).setSelected(true);
                        }
//                        ((ViewGroup) arcFramelayout.getChildAt(i)).getChildAt(0).setBackgroundColor(Color.parseColor("#80FF0000"));
                    } else {
                        ViewGroup parent = ((ViewGroup) arcFramelayout.getChildAt(i));
                        parent.setSelected(false);
                        for (int j = 0; j < parent.getChildCount(); j++) {
                            parent.getChildAt(j).setSelected(false);
                        }
//                        ((ViewGroup) arcFramelayout.getChildAt(i)).getChildAt(0).setBackground(null);
                    }
                }
            }

            @Override
            public void onItemClick(int viewId) {
                Toast.makeText(MainActivity.this, "tag=" + findViewById(viewId).getTag(), Toast.LENGTH_SHORT).show();
                switch (viewId) {
                    case R.id.ll_phone:
                        break;
                    case R.id.ll_flag:
                        break;
                    case R.id.ll_connect:
                        break;
                    case R.id.ll_setting:
                        break;
                    case R.id.ll_audi:
                        break;
                    case R.id.ll_dashboard:
                        break;
                    case R.id.ll_earth:
                        break;
                    case R.id.ll_cd:
                        break;
                }
            }
        });

        findViewById(R.id.iv_small_arrow).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                arcFramelayout.rotate(false);
            }
        });
        findViewById(R.id.iv_big_arrow).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                arcFramelayout.rotate(true);
            }
        });
    }
}

3.布局

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/black"
    tools:context=".MainActivity">

    <com.you.arc.ArcView
        android:layout_width="1200px"
        android:layout_height="550px"
        android:visibility="gone"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

       <ImageView
           android:id="@+id/iv_small_arrow"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:src="@drawable/ic_small_arrow"
           android:layout_marginTop="140px"
           />

       <ImageView
           android:id="@+id/iv_big_arrow"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:src="@drawable/ic_big_arrow"
           android:layout_gravity="bottom"
           android:layout_marginBottom="40px"
           />

    <com.you.arc.ArcFramelayout
        android:id="@+id/arc_framelayout"
        android:layout_width="1400px"
        android:layout_height="match_parent"
        android:layout_marginStart="0px"
        android:layout_marginTop="76px"
        android:background="@android:color/transparent">

        <LinearLayout
            android:id="@+id/ll_phone"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:tag="6">

            <ImageView
                android:layout_width="150px"
                android:layout_height="180px"
                android:src="@drawable/phone_selector"
                android:background="@android:color/transparent"
                />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical"
                android:maxWidth="330px"
                android:background="@drawable/green_text_selector"
                android:text="电话"
                android:textColor="@android:color/white"
                android:textSize="45px"
                android:textStyle="bold" />
        </LinearLayout>

        <LinearLayout
            android:id="@+id/ll_flag"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:tag="36">

            <ImageView
                android:layout_width="150px"
                android:layout_height="180px"
                android:src="@drawable/phone_selector"
                android:background="@android:color/transparent"
                />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical"
                android:maxWidth="330px"
                android:background="@drawable/blue_text_selector"
                android:text="旗帜"
                android:textColor="@android:color/white"
                android:textSize="45px"
                android:textStyle="bold" />
        </LinearLayout>

        <LinearLayout
            android:id="@+id/ll_connect"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:tag="62">

            <ImageView
                android:layout_width="150px"
                android:layout_height="180px"
                android:background="@android:color/transparent"
                android:src="@drawable/phone_selector"
                />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical"
                android:maxWidth="330px"
                android:background="@drawable/green_text_selector"
                android:text="蓝牙连接"
                android:textColor="@android:color/white"
                android:textSize="45px"
                android:textStyle="bold" />

        </LinearLayout>

        <LinearLayout
            android:id="@+id/ll_setting"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:tag="90">

            <ImageView
                android:layout_width="150px"
                android:layout_height="180px"
                android:src="@drawable/phone_selector"
                android:background="@android:color/transparent"
                />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical"
                android:background="@drawable/blue_text_selector"
                android:maxWidth="330px"
                android:text="设置"
                android:textColor="@android:color/white"
                android:textSize="45px"
                android:textStyle="bold" />
        </LinearLayout>

        <LinearLayout
            android:id="@+id/ll_audi"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:tag="262">

            <ImageView
                android:layout_width="150px"
                android:layout_height="180px"
                android:src="@drawable/phone_selector"
                android:background="@android:color/transparent"
                />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical"
                android:maxWidth="330px"
                android:background="@drawable/red_text_selector"
                android:text="手机"
                android:textColor="@android:color/white"
                android:textSize="45px"
                android:textStyle="bold" />
        </LinearLayout>

        <LinearLayout
            android:id="@+id/ll_dashboard"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:tag="286">

            <ImageView
                android:layout_width="150px"
                android:layout_height="180px"
                android:src="@drawable/phone_selector"
                android:background="@android:color/transparent"
                />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical"
                android:maxWidth="330px"
                android:background="@drawable/red_text_selector"
                android:text="时钟"
                android:textColor="@android:color/white"
                android:textSize="45px"
                android:textStyle="bold" />
        </LinearLayout>

        <LinearLayout
            android:id="@+id/ll_earth"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:tag="311">

            <ImageView
                android:layout_width="150px"
                android:layout_height="180px"
                android:src="@drawable/phone_selector"
                android:background="@android:color/transparent"
                />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical"
                android:maxWidth="330px"
                android:background="@drawable/green_text_selector"
                android:text="地球"
                android:textColor="@android:color/white"
                android:textSize="45px"
                android:textStyle="bold" />
        </LinearLayout>

        <LinearLayout
            android:id="@+id/ll_cd"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:tag="337">

            <ImageView
                android:layout_width="150px"
                android:layout_height="180px"
                android:src="@drawable/phone_selector"
                android:background="@android:color/transparent"
                />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical"
                android:maxWidth="330px"
                android:background="@drawable/yellow_text_selector"
                android:text="媒体"
                android:textColor="@android:color/white"
                android:textSize="45px"
                android:textStyle="bold" />
        </LinearLayout>

    </com.you.arc.ArcFramelayout>
    </FrameLayout>
</FrameLayout>

手势滑动目前尚未完善,可以根据实际需求完善

demo下载地址:https://download.csdn.net/download/qq_29364417/90203270


http://www.kler.cn/a/460059.html

相关文章:

  • 小波滤波器处理一维信号-附Matlab源代码
  • Javascript数据结构——图Graph
  • 机器学习之正则化惩罚和K折交叉验证调整逻辑回归模型
  • 深入解析 Wireshark 的 TLS 设置:应用场景与实操技巧
  • 某小程序sign签名参数逆向分析
  • AI知识库与用户行为分析:优化用户体验的深度洞察
  • 【UE5 C++课程系列笔记】15——Assert的基本使用
  • vue3<script setup>中使用Swiper
  • 第八节:GLM-4v-9b模型的大语言模型源码解读(ChatGLMForConditionalGeneration)
  • windows C#-带有命名方法的委托与匿名方法
  • 基于springboot的校园新闻网站系统
  • [创业之路-225]:《华为闭环战略管理》-4-华为的商业智慧:在价值链中探索取舍之道与企业边界
  • WAP短信格式解析及在Linux下用C语言实现
  • 【Spring MVC 核心机制】核心组件和工作流程解析
  • 【OTA】论文学习笔记--《基于RTOS的车载ECU双分区OTA升级技术分析报告》
  • 3.阿里云flinkselectdb-py作业
  • 什么是微服务、微服务如何实现Eureka,网关是什么,nacos是什么
  • PyTorch快速入门教程【小土堆】之Sequential使用和小实战
  • 【RK3588 Linux 5.x 内核编程】-内核IO复用与select
  • 防火墙基础-工作原理
  • 爱思唯尔word模板
  • UE(虚幻)学习(二) 使用UnrealSharp插件让UE支持C#脚本
  • Harbor(2.3.0)的定制页面与安装(x86 arm)
  • 科龙空调:以创新科技,适配多元家居场景
  • 最短路径-Dijkstra 算法
  • 【记录】列表自动滚动轮播功能实现