Android 旋转盘导航栏

news2025/1/4 15:05:09

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.coloradmin.cn/o/2269311.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

手搓一个ChatUI需要分几步

只关注项目代码的同学可以直接跳转目录中的正文部分&#xff0c;查看项目仓库和功能介绍。 引言 Chatbot的UI界面设计&#xff0c;是和传统软件不同的&#xff1a;都是当面一个简洁的对话框&#xff0c;框里预备着热乎的工具&#xff0c;可以随时更新。 像我这样做工的牛马&a…

低代码开发深度剖析:JNPF 如何引领变革

在当今数字化转型加速的时代&#xff0c;低代码开发已成为众多企业提升效率、降低成本的关键利器。它打破了传统开发模式的高门槛和冗长流程&#xff0c;让应用开发变得更加高效、灵活与普惠。 低代码开发的核心优势 低代码开发平台通过可视化的操作界面&#xff0c;减少了对…

uniapp实现APP、小程序与webview页面间通讯

需求&#xff1a; 1、需要在Uniapp开发的APP或小程序页面嵌入一个H5网页&#xff0c;需要拿到H5给APP传递的数据。 2、并且这个H5是使用vuevant开发的。&#xff08;其实跟使用uniapp开发H5一样&#xff09; 实现步骤&#xff1a; 1、首先需要兼容多端和App端&#xff0c;因…

网络游戏之害

网络游戏之害&#xff1a; 网络游戏于今之世风靡四方&#xff0c;其娱人耳目、畅人心怀之效&#xff0c;固为人知&#xff0c;然所藏之害&#xff0c;若隐伏之暗潮&#xff0c;汹涌而至时&#xff0c;足以覆舟&#xff0c;尤以青年为甚&#xff0c;今且缕析其害&#xff0c;以…

数据库的创建与删除:理论与实践

title: 数据库的创建与删除:理论与实践 date: 2024/12/31 updated: 2024/12/31 author: cmdragon excerpt: 在当今的数字时代,数据的管理和存储变得尤为重要。数据库作为数据存储的结构化方案,为数据的增删改查提供了系统化的方法。在一个典型的数据库管理系统中,创建和…

【电机控制】基于STC8H1K28的六步换向——方波驱动(软件篇)

【电机控制】基于STC8H1K28的六步换向——方波驱动&#xff08;软件篇&#xff09; 文章目录 [TOC](文章目录) 前言一、main.c二、GPIO.c三、PWMA.c四、ADC.c五、CMP.c六、Timer.c七、PMSM.c八、参考资料总结 前言 【电机控制】STC8H无感方波驱动—反电动势过零检测六步换向法 …

优化租赁小程序提升服务效率与用户体验的策略与实践

内容概要 在这个快速发展的商业环境中&#xff0c;租赁小程序成为了提升服务效率和用户体验的重要工具。通过对用户需求的深入挖掘&#xff0c;我们发现他们对于功能的便捷性、响应速度和界面的友好性有着极高的期待。因此&#xff0c;针对这些需求&#xff0c;完善租赁小程序…

电子电器架构 --- 智能座舱与AI结合

我是穿拖鞋的汉子&#xff0c;魔都中坚持长期主义的汽车电子工程师。 老规矩&#xff0c;分享一段喜欢的文字&#xff0c;避免自己成为高知识低文化的工程师&#xff1a; 所谓鸡汤&#xff0c;要么蛊惑你认命&#xff0c;要么怂恿你拼命&#xff0c;但都是回避问题的根源&…

C语言 斐波那契数列(递归算法)

C语言 斐波那契数列&#xff08;递归算法&#xff09; 什么是斐波那契数列&#xff1f; 是指这样一个数列&#xff1a;0&#xff0c;1&#xff0c;1&#xff0c;2&#xff0c;3&#xff0c;5&#xff0c;8&#xff0c;13……这个数列从第3项开始 &#xff0c;每一项都等于前两…

互联网直播点播平台EasyDSS无人机视频推拉流技术实现工地远程监控巡检直播

在建筑行业&#xff0c;施工现场的安全管理和实时监控一直是项目管理中的重点。随着技术的进步&#xff0c;无人机工地直播技术成为了一种新兴的解决方案&#xff0c;它不仅能够提高施工透明度&#xff0c;还能够加强现场安全管理。EasyDSS作为一种先进的流媒体技术平台&#x…

【每日学点鸿蒙知识】模拟器开启网络、长时任务、兼容性测试支持、丢帧定位、SO中访问rawfile等

1、模拟器如何开启网络&#xff1f; 模拟器使用的是电脑本身的网络&#xff0c;不通过代理即可访问网络。 2、创建子window后&#xff0c;锁屏很短时间内&#xff0c;应用会被杀死&#xff1f; 没开长时任务&#xff0c;锁屏和退后台保活要开长时任务。 应用退至后台后&…

计算机网络 (18)使用广播信道的数据链路层

一、广播信道的基本概念 广播信道是一种允许一个发送者向多个接收者发送数据的通信信道。在计算机网络中&#xff0c;广播信道通常用于局域网&#xff08;LAN&#xff09;内部的主机之间的通信。这种通信方式的主要优点是可以节省线路&#xff0c;实现资源共享。 二、广播信道数…

深度学习——损失函数汇总

1. 连续值损失函数 总结:主要使用胡贝儿损失函数,应用于连续数值的预测之间的误差损失,参考地址 import torch import torch.nn as nna = torch.tensor([[1, 2], [3, 4]], dtype=torch.float) b = torch.tensor([[3, 5], [8, 6]], dtype=torch.float)loss_fn1 = torch.nn.M…

github 项目分享

今天和大家分享一些github上面搜到关于卫星遥感和水环境相关的项目。 一、WaterDetect 使用端到端算法去识别水体范围的算法&#xff0c;针对哨兵2卫星遥感数据可用。 项目地址&#xff1a; https://github.com/cordmaur/WaterDetect 二、DeepWaterMap 深度卷积神经网络去…

音视频入门基础:MPEG2-PS专题(2)——使用FFmpeg命令生成ps文件

一、错误的命令 通过FFmpeg命令可以将mp4文件转换为ps文件&#xff0c;PS文件中包含PS流数据。 由于PS流/PS文件对应的FFInputFormat结构为&#xff1a; const FFInputFormat ff_mpegps_demuxer {.p.name "mpeg",.p.long_name NULL_IF_CONFIG_SMALL…

活动预告 | Microsoft Azure 在线技术公开课:使用 Azure OpenAI 服务构建生成式应用

课程介绍 通过 Microsoft Learn 免费参加 Microsoft Azure 在线技术公开课&#xff0c;掌握创造新机遇所需的技能&#xff0c;加快对 Microsoft Cloud 技术的了解。参加我们举办的“使用 Azure OpenAI 服务构建生成式应用”活动&#xff0c;了解如何使用包括 GPT 在内的强大的…

springboot523基于Spring Boot的大学校园生活信息平台的设计与实现(论文+源码)_kaic

摘 要 现代经济快节奏发展以及不断完善升级的信息化技术&#xff0c;让传统数据信息的管理升级为软件存储&#xff0c;归纳&#xff0c;集中处理数据信息的管理方式。本大学校园生活信息平台就是在这样的大环境下诞生&#xff0c;其可以帮助管理者在短时间内处理完毕庞大的数据…

机器学习详解(11):分类任务的模型评估标准

模型评估是利用不同的评估指标来了解机器学习模型的性能&#xff0c;以及其优势和劣势的过程。评估对于确保机器学习模型的可靠性、泛化能力以及在新数据上的准确预测能力至关重要。 文章目录 1 介绍2 评估准则3 分类指标3.1 准确率 (Accuracy)3.2 精确率 (Precision)3.3 召回率…

天天跳绳(???)

广东省人民政府门户网站 https://www.gd.gov.cn/zwgk/zdlyxxgkzl/whjg/content/post... 二沙岛变身智能“运动岛” - 广东省人民政府门户网站 2020年10月20日  广州二沙岛&#xff0c;犹如一颗璀璨明珠点缀在珠江之心&#xff0c;自然风光旖旎&#xff0c;功能分区清 … 公共…

2025元旦源码免费送

我们常常在当下感到时间慢&#xff0c;觉得未来遥远&#xff0c;但一旦回头看&#xff0c;时间已经悄然流逝。对于未来&#xff0c;尽管如此&#xff0c;也应该保持一种从容的态度&#xff0c;相信未来仍有许多可能性等待着我们。 免费获取源码。 更多内容敬请期待。如有需要可…