Android之仿饿了吗购物车抛物线动画

Android 利用二次贝塞尔曲线模仿购物车添加物品抛物线动画 Android 利用二次贝塞尔曲线模仿购物车添加物品抛物线动画 0.首先,先给出一张效果gif图。 1.贝塞尔曲线原理及相关公式参考:http://www.jianshu.com/p/c0d7ad796cee 作者:许方镇 。 2.原理:计算被点击 view、购物车view 以及他们所在父容器相对于屏幕的坐标。 3.在呗点击View坐标位置 父容器通过addView 增 阅读详情

一:效果图、

二:实现的步骤:

1.在主工程build.gradle文件下加入包并引用,这个必须得要

compile 'com.android.support:design:23.3.0'
compile 'com.flipboard:bottomsheet-core:1.5.1'
compile 'se.emilsjolander:stickylistheaders:2.7.0'

2.主activity的xml布局

<!--底部购物车-->
<RelativeLayout
    android:id="@+id/bottom"
    android:layout_width="match_parent"
    android:layout_height="50dp"
    android:layout_alignParentBottom="true"
    android:background="#aa000000"
    android:clickable="true"
    android:gravity="center_vertical"
    android:onClick="onClick"
    android:orientation="horizontal">

    <RelativeLayout
        android:id="@+id/relative_gwc"
        android:layout_width="60dp"
        android:layout_height="match_parent">

        <ImageView
            android:id="@+id/imgCart"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:src="@mipmap/chaoshi_shopping_nav_icon" />

        <TextView
            android:id="@+id/tvount"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_marginRight="5dp"
            android:layout_marginTop="5dp"
            android:background="@drawable/circle_red"
            android:gravity="center"
            android:text="0"
            android:textColor="#fff"
            android:textSize="12sp"
            android:visibility="gone" />
    </RelativeLayout>

    <TextView
        android:id="@+id/tvCost"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="10dp"
        android:layout_marginTop="5dp"
        android:layout_toRightOf="@+id/relative_gwc"
        android:text="¥ 0.0"
        android:textColor="#fff"
        android:textSize="18dp" />

    <TextView
        android:id="@+id/manps"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/tvCost"
        android:layout_toRightOf="@+id/relative_gwc"
        android:text="满20免费配送"
        android:textColor="#fff" />

    <TextView
        android:id="@+id/tvSubmit"
        android:layout_width="120dp"
        android:layout_height="match_parent"
        android:layout_alignParentRight="true"
        android:background="#22c222"
        android:clickable="true"
        android:gravity="center"
        android:onClick="onClick"
        android:text="去结算"
        android:textColor="#fff"
        android:textSize="18sp" />
</RelativeLayout>

3.listview的item布局

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="110dp"
    android:background="#ffffff"
    android:orientation="horizontal">

    <RelativeLayout
        android:id="@+id/relativecll"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <ImageView
            android:id="@+id/imgnl"
            android:layout_width="80dp"
            android:layout_height="80dp"
            android:layout_centerVertical="true"
            android:layout_margin="10dp"
            android:layout_marginLeft="10dp"
            android:src="@mipmap/ic_launcher" />

        <TextView
            android:id="@+id/textItem"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="5dp"
            android:layout_marginTop="10dp"
            android:layout_toRightOf="@+id/imgnl"
            android:ellipsize="end"
            android:lines="2"
            android:maxLines="2"
            android:text="哈哈"
            android:textColor="#262626"
            android:textSize="14dp" />

        <TextView
            android:id="@+id/jiage"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/textItem"
            android:layout_toRightOf="@+id/imgnl"
            android:text="¥3.5"
            android:textColor="#e92c24"
            android:textStyle="bold" />

        <TextView
            android:id="@+id/xiaoliang"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/jiage"
            android:layout_marginTop="5dp"
            android:layout_toRightOf="@+id/imgnl"
            android:text="销量:236"
            android:textColor="#999999"
            android:textSize="12dp" />

    </RelativeLayout>

    <ImageView
        android:id="@+id/bdgwc"
        android:layout_width="45dp"
        android:layout_height="45dp"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:layout_marginBottom="15dp"
        android:src="@mipmap/chaoshi_shopingjia_icon"
        android:visibility="gone" />

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:layout_marginBottom="15dp"
        android:layout_marginRight="10dp"
        android:gravity="right">

        <TextView
            android:id="@+id/tvMinus"
            android:layout_width="20dp"
            android:layout_height="20dp"
            android:background="@mipmap/button_minus"
            android:clickable="true"
            android:gravity="center"
            android:textStyle="bold"
            android:visibility="gone" />

        <TextView
            android:id="@+id/count"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:layout_marginBottom="3dp"
            android:gravity="center"
            android:minWidth="20dp"
            android:text="0"
            android:textSize="16sp"
            android:visibility="gone" />

        <TextView
            android:id="@+id/tvAdd"
            android:layout_width="20dp"
            android:layout_height="20dp"
            android:layout_marginBottom="7dp"
            android:background="@mipmap/button_add"
            android:clickable="true"
            android:gravity="center"
            android:textStyle="bold" />
    </LinearLayout>
</RelativeLayout>

4.因为我数据原因,所以我写了两个Adapter,所以写了一个公共的方法,一个适配器的直接可以把这个方法写到Adapter里面

package com.zjtd.bzcommunity.view;

import android.view.View;

/**
 * Created by dong.he on 2017/2/22.
 */

public interface AddPriceListener {
    /**
     * 添加商品到购物车
     *
     * @param position
     * @param showCountView
     */
    void addGoods(int position, View showCountView);

    /**
     * 从购物车减去商品
     *
     * @param position
     * @param showCountView
     */
    void decreaseGoods(int position, View showCountView);
}

5.Adapterr,里面都写好了注释,就不用一步一步的给你们解释了,自己看注释

package com.zjtd.bzcommunity.adapter;

import android.annotation.SuppressLint;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.RotateAnimation;
import android.view.animation.TranslateAnimation;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.common.base.http.HttpPost;
import com.common.base.http.model.GsonObjModel;
import com.common.base.service.BaseServerConfig;
import com.common.base.util.BitmapHelp;
import com.lidroid.xutils.http.RequestParams;
import com.zjtd.bzcommunity.R;
import com.zjtd.bzcommunity.activity.RecyleActivity;
import com.zjtd.bzcommunity.bean.ChaoshidianpuBean;
import com.zjtd.bzcommunity.util.ConstantUtil;
import com.zjtd.bzcommunity.util.SpUtil;
import com.zjtd.bzcommunity.view.AddPriceListener;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.List;

/**
 * Created by Administrator on 2016/12/24.
 */
public class RecyleActivityrexiaoAdapter extends BaseAdapter {
    private List<ChaoshidianpuBean.Rexiao> mListy;
    private LayoutInflater inflater;
    private RecyleActivity mContext;
    private int goodsCount = 0;
    private AddPriceListener listener;

    public RecyleActivityrexiaoAdapter(RecyleActivity context) {
        this.mContext = context;
        this.inflater = LayoutInflater.from(mContext);
    }

    public void setData(List<ChaoshidianpuBean.Rexiao> mPageList) {
        this.mListy = mPageList;
    }

    @Override
    public int getCount() {
        return mListy == null ? 0 : mListy.size();
    }

    @Override
    public Object getItem(int position) {
        return mListy != null ? mListy.get(position) : 0;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    class ViewHolder {
        public TextView content, jiage, xiaoliang, tvAdd, tvMinus, tvCount;
        public ImageView imgnl, bdgwc;
    }

    @SuppressLint("InflateParams")
    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
        final ViewHolder holder;
        if (convertView == null) {
            convertView = inflater.inflate(R.layout.list_item, null);
            holder = new ViewHolder();
            holder.content = (TextView) convertView.findViewById(R.id.textItem);
            holder.jiage = (TextView) convertView.findViewById(R.id.jiage);
            holder.xiaoliang = (TextView) convertView.findViewById(R.id.xiaoliang);
            holder.imgnl = (ImageView) convertView.findViewById(R.id.imgnl);
            holder.bdgwc = (ImageView) convertView.findViewById(R.id.bdgwc);
            holder.tvCount = (TextView) convertView.findViewById(R.id.count);
            holder.tvMinus = (TextView) convertView.findViewById(R.id.tvMinus);
            holder.tvAdd = (TextView) convertView.findViewById(R.id.tvAdd);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }

        // 绑定数据
        final ChaoshidianpuBean.Rexiao data = (ChaoshidianpuBean.Rexiao) getItem(position);
        holder.content.setText(data.title);
        BitmapHelp.displayOnImageView(mContext, holder.imgnl,
                data.lbpic, R.drawable.ic_launcher,
                R.drawable.ic_launcher);
        holder.jiage.setText("¥ " + data.price);
        holder.xiaoliang.setText("销量:" + data.sales_number);
        final ViewHolder finalHolder = holder;
        /**
         * 初始化数量为0,判断数量大于0显示数量和减号,否则隐藏
         */
        if (goodsCount < 1) {
            holder.tvCount.setVisibility(View.GONE);
            holder.tvMinus.setVisibility(View.GONE);
        } else {
            holder.tvCount.setVisibility(View.VISIBLE);
            holder.tvMinus.setVisibility(View.VISIBLE);
        }

        holder.tvCount.setText(data.getCount() + "");
        /**
         * 获取变化后的数量再判断数量大于0显示数量和减号,否则隐藏
         */
        if (data.getCount() > 0) {
            holder.tvMinus.setVisibility(View.VISIBLE);
            holder.tvCount.setVisibility(View.VISIBLE);
        } else {
            holder.tvMinus.setVisibility(View.GONE);
            holder.tvCount.setVisibility(View.GONE);
        }

        /**
         * 加
         */
        holder.tvAdd.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                RecyleActivity activity = mContext;

                //接口回调商品价格
                listener.addGoods(position, holder.tvCount);
                //获取数量判断,如果小于1就执行减号弹出动画
                if (data.getCount() < 1) {
                    holder.tvMinus.setAnimation(getShowAnimation());
                    holder.tvMinus.setVisibility(View.VISIBLE);
                    holder.tvCount.setVisibility(View.VISIBLE);
                }
                int[] loc = new int[2];
                //执行点击加号抛物线动画,该方法在activity中
                view.getLocationInWindow(loc);
                activity.playAnimation(loc);

            }
        });

        /**
         * 减
         */
        holder.tvMinus.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                listener.decreaseGoods(position, holder.tvCount);
                //获取数量判断,如果小于1就执行减号弹回动画
                if (data.getCount() < 1) {
                    holder.tvMinus.setAnimation(getHiddenAnimation());
                    holder.tvMinus.setVisibility(View.GONE);
                    holder.tvCount.setVisibility(View.GONE);
                }

            }
        });

        return convertView;
    }

    /**
     * 点击加号减号弹出动画
     * @return
     */
    private Animation getShowAnimation() {
        AnimationSet set = new AnimationSet(true);
        RotateAnimation rotate = new RotateAnimation(0, 720, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f);
        set.addAnimation(rotate);
        TranslateAnimation translate = new TranslateAnimation(
                TranslateAnimation.RELATIVE_TO_SELF, 2f
                , TranslateAnimation.RELATIVE_TO_SELF, 0
                , TranslateAnimation.RELATIVE_TO_SELF, 0
                , TranslateAnimation.RELATIVE_TO_SELF, 0);
        set.addAnimation(translate);
        AlphaAnimation alpha = new AlphaAnimation(0, 1);
        set.addAnimation(alpha);
        set.setDuration(500);
        return set;
    }

    /**
     * 点击减号减号弹回动画
     * @return
     */
    private Animation getHiddenAnimation() {
        AnimationSet set = new AnimationSet(true);
        RotateAnimation rotate = new RotateAnimation(0, 720, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f);
        set.addAnimation(rotate);
        TranslateAnimation translate = new TranslateAnimation(
                TranslateAnimation.RELATIVE_TO_SELF, 0
                , TranslateAnimation.RELATIVE_TO_SELF, 2f
                , TranslateAnimation.RELATIVE_TO_SELF, 0
                , TranslateAnimation.RELATIVE_TO_SELF, 0);
        set.addAnimation(translate);
        AlphaAnimation alpha = new AlphaAnimation(1, 0);
        set.addAnimation(alpha);
        set.setDuration(500);
        return set;
    }

    /**
     * activity点击回调事件
     * @param listener
     */
    public void setOnClickGoodsListener(AddPriceListener listener) {
        this.listener = listener;
    }

}

6.在activity里面写的抛物线动画方法

/**
 * 抛物线动画
 * @param start_location
 */
public void playAnimation(int[] start_location) {
    ImageView img = new ImageView(this);
    img.setImageResource(R.mipmap.button_add);
    setAnim(img, start_location);
}
//anim_mask_layout为主界面根布局id
private void setAnim(final View v, int[] start_location) {

    addViewToAnimLayout(anim_mask_layout, v, start_location);
    Animation set = createAnim(start_location[0], start_location[1]);
    set.setAnimationListener(new Animation.AnimationListener() {
        @Override
        public void onAnimationStart(Animation animation) {

        }

        @Override
        public void onAnimationEnd(final Animation animation) {
            mHanlder.postDelayed(new Runnable() {
                @Override
                public void run() {
                    anim_mask_layout.removeView(v);
                }
            }, 100);
        }

        @Override
        public void onAnimationRepeat(Animation animation) {

        }
    });
    v.startAnimation(set);
}

private void addViewToAnimLayout(final ViewGroup vg, final View view,
                                 int[] location) {
    int x = location[0];
    int y = location[1];
    int[] loc = new int[2];
    vg.getLocationInWindow(loc);
    view.setX(x);
    view.setY(y - loc[1]);
    vg.addView(view);
}

private Animation createAnim(int startX, int startY) {
    int[] des = new int[2];
    imgCart.getLocationInWindow(des);
    AnimationSet set = new AnimationSet(false);
    Animation translationX = new TranslateAnimation(0, des[0] - startX, 0, 0);
    translationX.setInterpolator(new LinearInterpolator());
    Animation translationY = new TranslateAnimation(0, 0, 0, des[1] - startY);
    translationY.setInterpolator(new AccelerateInterpolator());
    Animation alpha = new AlphaAnimation(1, 0.5f);
    set.addAnimation(translationX);
    set.addAnimation(translationY);
    set.addAnimation(alpha);
    set.setDuration(500);
    return set;
}

7.activity类Adapter数据的绑定和加减法的操作

listViewAdpretrex.setData(haoshihomebean.rexiao);


listViewAdpretrex = new RecyleActivityrexiaoAdapter(RecyleActivity.this);
right_listview.setAdapter(listViewAdpretrex);

listViewAdpretrex.setOnClickGoodsListener(new AddPriceListener() {
    /**
     * 添加商品价格
     * @param position
     * @param showCountView
     * @param
     */
    @Override
    public void addGoods(int position, View showCountView) {
        ChaoshidianpuBean.Rexiao product = (ChaoshidianpuBean.Rexiao) listViewAdpretrex.getItem(position);
        int currentCount = product.getCount();
        currentCount++;
        product.setCount(currentCount);
        ((TextView) showCountView).setText(currentCount + "");
        listViewAdpretrex.notifyDataSetChanged();
        calculate();
    }

    /**
     * 删减商品价格
     * @param position
     * @param showCountView
     * @param
     */
    @Override
    public void decreaseGoods(int position, View showCountView) {
        ChaoshidianpuBean.Rexiao product = (ChaoshidianpuBean.Rexiao) listViewAdpretrex.getItem(position);
        int currentCount = product.getCount();
        if (currentCount == 0)
            return;
        currentCount--;
        product.setCount(currentCount);
        ((TextView) showCountView).setText(currentCount + "");
        listViewAdpretrex.notifyDataSetChanged();
        calculate();
    }

});

8.购买数量和价格的计算

private double totalPrice = 0.00;// 购买的商品总价
private int totalCount = 0;// 购买的商品总数量

/**
 * 统计操作
 * 1.先清空全局计数器
 * 2.遍历所有子元素,只要是被选中状态的,就进行相关的计算操作
 * 3.给底部的textView进行数据填充
 */
private void calculate() {
    totalCount = 0;
    totalPrice = 0.00;

    for (int j = 0; j < haoshihomebean.rexiao.size(); j++) {
        ChaoshidianpuBean.Rexiao product = haoshihomebean.rexiao.get(j);
        if (product.getCount() > 0) {
            totalCount += product.getCount();
            totalPrice += Double.parseDouble(product.getPrice()) * product.getCount();
        }
    }

    cll = totalPrice1 + totalPrice;
    tvCost.setText("¥" + cll);
    if (totalCount1 + totalCount > 0) {
        tvCount.setVisibility(View.VISIBLE);
        tvCount.setText(totalCount1 + totalCount + "");
    } else {
        tvCount.setVisibility(View.GONE);
    }
}

-----差不多就是这些了,有用的可以采纳一下,大神勿喷,有更好的建议欢迎提出、

两种购物车抛物线动画实现方案详解 为了让代码更优雅,我们可以继承,直接让输出坐标对象:使用方式:这种方式减少了频繁计算,性能更好。为了提高复用性,可以把常用动画写成XML:-- 其他属性... --></set>加载并应用:非常适合团队协作和主题化管理。 阅读详情

相关推荐

仿外卖购物车的实现

仿饿了么购物车的简单实现 下载到的文件是个AS module,你可以在自己新建的工程中Import Module. 博客地址:http://blog.youkuaiyun.com/w804518214/article/details/51570975

Android 仿饿了么加入购物车特效控件(自定义View实战)

利用 纯自定义View,实现的仿饿了么加入购物车控件,自带闪转腾挪动画的按钮。

反编译出来的京东App源代码,内容全,仅供学习参考

反编译出来的京东App源代码,内容全,仅供学习参考

Android仿外卖购物车的实现

又两周没写博客了,不是不想写而是不知道该写点什么,总不能为了写博客而写博客,前两天项目里要加个购物车功能,看了下别人APP的效果觉得不错,虽然我项目里没用上不过毕竟还算是个常用的功能,于是决定写个博客分享下! 效果图知识点分析效果图来看不复杂内容并没多少,值得介绍一下的知识点也就下面几个吧 - 列表标题悬停 - 左右列表滑动时联动 - 添加商品时的抛物线动画 - 底部弹出购物车清单 - 数

God is a coder! 3万+

安卓Android带支付宝在线支付购物商城app设计源码案例设计.zip

源码设计,具体请到资源详情查看使用前必读

Android商城程序源码

Android商城程序源码

【Android】实现简易购物车功能(附源码)

android实现简易的购物车

butterfly_new的博客 2498

欧姆龙485通讯示例程序_【精品实验】PLC学习神器与温湿度变送器的通讯

BFH点击蓝字关注我们↑↑↑↑  PLC学习神器提供RS485接口,可支持无协议RS指令、无协议RS2指令、Modbus通讯功能,可通过设置通讯格式改变通讯协议,RS485对应的通讯格式地址是D8400;  本案例以RS485接口与温湿度变送器通讯,通讯格式如下一温湿度变送器的说明书介绍1.1主要技术参数1.2 通讯协议 1、所有通讯回路都应遵照主/从方式。依照主从方式,数据可以在一个主...

weixin_39860201的博客 1万+

android饿了么购物车,Android仿饿了么购物车效果

先看下效果图:ezgif-1-8f133ca916.gif1.首先列表布局采用Recycleviewandroid:id="@+id/container"android:layout_width="match_parent"android:layout_height="match_parent">android:id="@+id/rv"android:layout_width="match_...

weixin_36059505的博客 369

如何使用Calibre PERC抽出 点到点/p2p 电阻

@[TOC](如何使用Calibre PERC抽点到点(p2p)电阻) 一、前言 需要实现的功能是从gds中抽出net的点到点的电阻。如下图这样。 二、准备工作 lvs rule pex rule(必要时可以自己定义RC rule) gds p2p点的坐标 定义prode.defs 因为p2p的点是变化的,所以每次prode定义都要重新出,对应的perc rule也是根据每个p2p点的定义来的,perc rule也是每次都要重新出。如果需要可以写一个脚本自动出这些定义文件。 PROBE_POINTS

kobayashiyou的博客 1万+

Conda安装cuda指定版本遇到的一个大坑,导致pytorch无法使用cuda且nvcc -V显示错误的cuda版本

24年3月份的时候用conda install nvidia/label/cuda-11.x.x::cuda还挺正常的,能直接安装11.x.x版本的cuda,我还安利给同学用。但现在5月份不知道为什么这些命令都只会安装最新的cuda12.4,不知道是我哪里设置有问题还是官网的安装目录里的环境配置换了?我在三台不同的服务器上都尝试了安装不同版本的cuda,但最后安装下来的都是12.4版本。

weixin_43933424的博客 8895

android仿饿了吗加入购物车,仿饿了么添加购物车动画

public class ProductAdapter extends BaseAdapter{private int reduceLeft = 0;private int addLeft = 0;private static final long TIME = 300; // 动画的执行时间public ProductAdapter(Context context) {super(conte...

weixin_42521558的博客 289

利用SPSS实现逻辑回归,树模型,以及广义线性模型

本案例是IBM SPSS数据分析与挖掘实战案例精粹----第九章的学习记录 案例背景:分析出导致急救后迟发性颅脑损伤的主要影响因素,共有201项案例: 分析思路:先使用logistic回归模型进行影响因素筛选,然后利用分类树探索自变量中是否存在交互作用,最后利用广义线性模型过程拟合带交互项的Logistic回归模型 字段:性别,年龄,收缩压,舒张压,血小板,脑挫伤,中线位移,脑肿胀,入院意识,是否手术急救,其余急救措施,是否出现迟发性脑损伤; ...

hepan_defeng的博客 1万+

Android仿饿了么购物车功能

现在商城应用上,购物车功能可以说是不可缺少的,每个应用的购物车模块实现方式都差不多,这篇我们来仿一下饿了么的购物车功能,用过的童鞋都知道,印象最深刻的应该是添加或减少数量时,抛物线的动画效果,话不多说,现在让我们来看看是怎么实现的吧. 先看效果图 效果图可以看出,这个布局还是比较简单的,重点应该还是在抛物线的动画上. 1、列表布局文件 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://

龙旋的博客 1649

HT7036计量芯片SPI通信与数据读取实战解析

本文详细解析HT7036计量芯片的SPI通信与数据读取实战,涵盖SPI时序配置、命令发送、数据读取及常见问题排查。重点介绍如何通过SPI接口与MCU通信,实现电能数据的稳定采集与处理,为智能电表等应用提供实用解决方案。

vscode5coder的博客 267

基于TI MSPM0的PS2双轴按键摇杆模块ADC+GPIO驱动移植实战

本文详细介绍了在TI MSPM0微控制器上驱动PS2双轴按键摇杆模块的完整实战流程。通过SysConfig图形化工具配置ADC与GPIO引脚,并编写了包含ADC采样、按键检测及数据处理的驱动代码,实现了对摇杆X/Y轴模拟量及按键数字量的稳定读取,为嵌入式控制项目提供了可直接移植的解决方案。

weixin_42465140的博客 85

Android开发之购物车添加商品实现抛物线动画

老套路先上图:第一个是个人项目用到的效果图,第二个数抠出来的demo 说下思路很简单:第一步先拿到加号图片在屏幕的坐标(X,Y),然后拿到加号按钮图片的大小,然后将拿到的坐标和大小复制给一个新的图片按钮,将这个新的图片按钮添加到加号按钮的同一个位置。然后对这个新的加号按钮进行X,Y轴方向上的平移动画即可。具体实现请看代码: package com.xiayiye.honorfirst.a...

xiayiye5的博客 3334

lammps案例:聚乙烯和石墨烯界面pull out模拟

大家好,我是小马老师。 本文介绍lammps模拟计算界面结合力的一个案例。 本案例参考论文《The interfacial mechanical properties of functionalized graphene- polymer nanocomposites》,对论文作者表示感谢。 模型共分2层,上层为聚乙烯模型,下次为单层石墨烯,模拟过程共分3部分:建模、弛豫、拉伸。 (1)建模 使用MS建立聚乙烯和石墨烯模型,具体方法可参考之前的推文,使用build layer方法建立聚乙烯和石墨烯组合模型,

lammps_jiayou的博客 3498

android 加入购物车动画效果,Android仿天猫商品抛物线加入购物车动画

本文实例为大家分享了Android仿天猫加入购物车的具体代码,供大家参考,具体内容如下先上效果图实现思路:首先,我们需要三个Imagview第一个是原商品图片, 这个图片是布局文件中创建的 我们称作A第二个是做动画的图片 这个我们是在代码中创建的 我们称作B第三个是购物车图片 这个图片是布局文件中创建的 我们称作C接着,我们需要将A图片设置给BA图片一般是联网获取...

weixin_33391446的博客 463

ESP32网络开发实例-开发环境搭建

NodeMCU-ESP-32S开发环境搭建 NodeMCU-32S 最强的ESP32 开发板非盗版或副厂的CH340。WiFi 蓝牙ESP-32 可用Arduino IDE ESP32-S 是一款通用型WiFi-BT-BLE MCU模组,功能强大,用途广泛,可以用于低功耗传感器网络和要求极高的任务,例如语音编码、音频流和MP3解码等。 此款模组的核心是ESP32芯片,具有可扩展、自适应的特点。两个CPU核可以被单独控制或上电。时钟频率的调节范围为80 MHz到240 MHz。用户可以切断CPU的电源,利用低

视觉与物联智能 3783

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

美团加入购物车的抛物线动画

Android工程搭建1:克隆+号,并且添加到activity上2:执行抛物线动画(水平位移,垂直加速位移)3.动画完成后回收克隆的+号 kotlin 1:克隆+号,并且添加到activity上 var but = Button(context)//创建一个button对象 //设置大小,位置,背景全部相同 but.text = "+"//设置文本 but.setBackgroundResourc...

XinHao_Sir的博客 854

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

android 仿饿了么购物车

这次分享的是一个很常见的效果,凡是涉及到购物的app或者旅游类以及订餐类的app都有看到过这种效果,两个list view联动显示,添加购物车时的一个抛物线动画实现,以及图标或者item右上角的数字显示。下面是我空闲时候写的一个demo,界面比较陋,但是基本效果都实现了。 不多说,看效果图: 只对添加按钮做了监听,删除没去写(没什么必要)。 讲一些主要的代码,想下载源码的

Dream It Possible 1万+

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

别再用Interpolator了!SpringAnimation实现购物车抛物线动画的终极指南

本文深入探讨了在Android开发中,如何摒弃传统的Interpolator方案,转而使用SpringAnimation动力学动画来实现更自然、更具物理真实感的购物车抛物线动画。通过详细解析setStartVelocity()赋予动画初速度、阻尼比与刚度参数调优等核心技法,并结合实战代码,为开发者提供了一套优雅且高效的实现指南,显著提升应用交互体验。

chair的专栏 618

android 购物车 简书,Android仿饿了么购物车效果

先看下效果图:ezgif-1-8f133ca916.gif1.首先列表布局采用Recycleviewandroid:id="@+id/container"android:layout_width="match_parent"android:layout_height="match_parent">android:id="@+id/rv"android:layout_width="match_...

weixin_35511854的博客 335

android 抛物线轨迹,Android用Animation实现完整的抛物线效果

最近需求要做一个小球上升再下降的抛物线运动,类似太阳东升西落的动画。在网上找了好久,好多的抛物线都是平抛,用于购物车添加效果。于是自己动手,做了一个完整的向上抛物线的动画。首先要区分两个概念,一个是VIew的坐标系,如下图(来自网络) 另外一个就是Animation动画的坐标,最开始,我以为动画是在View坐标系上进行的。研究之后才发现,Animation有自己的坐标,跟View的坐标没有关系。如...

weixin_30979383的博客 2975

A拉起B的android购物车源码,Android仿天猫商品抛物线加入购物车动画

本文实例为大家分享了Android仿天猫加入购物车的具体代码,供大家参考,具体内容如下先上效果图实现思路:首先,我们需要三个Imagview第一个是原商品图片, 这个图片是布局文件中创建的 我们称作A第二个是做动画的图片 这个我们是在代码中创建的 我们称作B第三个是购物车图片 这个图片是布局文件中创建的 我们称作C接着,我们需要将A图片设置给BA图片一般是联网获取...

weixin_39945810的博客 191
上一篇: Android之输入银行卡号判断属于哪个银行
下一篇: Android之自定义Toast提示框样式
叶已初秋
博客等级 码龄11年 2684粉丝 82原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

叶已初秋

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值