Android-使用RecyclerView的ItemDecoration 实现炫酷的 吸顶效果

2023-05-16

转载请注明出处:李诗雨--http://blog.csdn.net/cjm2484836553/article/details/53453982


开始逐渐领略到ItemDecoration的美~


源码已上传至github,感兴趣的同学可以下载:

吸顶效果源码 https://github.com/junmei520/LSY_PullupRecyclerView


今天让我 使用 ItemDecoration 来完成 可推动的悬浮导航栏的效果,最终实现的效果如下图:



如果你对分类型的RecyclerView还不是太了解,可以参看我前面的文章,让你一分钟征服RecyclerView的基本使用。

如果你对ItemDecoration的使用也不太了解,那就再看下我的另外两篇文章吧:

使用ItemDecoration为RecyclerView的Item设置padding和使用ItemDecoration为RecyclerView的Item设置分割线。

总觉得循序渐进是一个不错的学习方法。


具体实现步骤如下:

根据我前面的文章所讲的RecyclerView的基本使用,我们先来完成基本的recyclerView

第一步:布局里写一个RecyclerView


第二步:实例化

recyclerView = (RecyclerView) findViewById(R.id.recyclerView);

第三步:获取所需的数据 (这里我们来个真实点的情景,去联网请求数据)

 /**
     * 联网请求所需的url
     */
    public String url="http://api.meituan.com/mmdb/movie/v2/list/rt/order/coming.json?ci=1&limit=12&token=&__vhost=api.maoyan.com&utm_campaign=AmovieBmovieCD-1&movieBundleVersion=6801&utm_source=xiaomi&utm_medium=android&utm_term=6.8.0&utm_content=868030022327462&net=255&dModel=MI%205&uuid=0894DE03C76F6045D55977B6D4E32B7F3C6AAB02F9CEA042987B380EC5687C43&lat=40.100673&lng=116.378619&__skck=6a375bce8c66a0dc293860dfa83833ef&__skts=1463704714271&__skua=7e01cf8dd30a179800a7a93979b430b2&__skno=1a0b4a9b-44ec-42fc-b110-ead68bcc2824&__skcy=sXcDKbGi20CGXQPPZvhCU3%2FkzdE%3D";
 //联网获取数据
        getDataFromNet();
/**
     * 使用okhttpUtils进行联网请求数据
     */
    private void getDataFromNet() {
        OkHttpUtils.
                get()
                .url(url)
                .build()
                .execute(new StringCallback() {
                    @Override
                    public void onError(okhttp3.Call call, Exception e, int id) {
                        Log.e("TAG", "联网失败" + e.getMessage());
                    }

                    @Override
                    public void onResponse(String response, int id) {
                        Log.e("TAG", "联网成功==" + response);

                        //联网成功后使用fastjson解析
                        processData(response);
                    }
                });
    }
/**
     * 使用fastjson进行解析
     *
     * @param json
     */
    private void processData(String json) {
        //这里使用GsonFormat生成对应的bean类
       JSONObject jsonObject = parseObject(json);

        String data = jsonObject.getString("data");
        JSONObject dataObj = JSON.parseObject(data);

        String coming = dataObj.getString("coming");
        List<WaitMVBean.DataBean.ComingBean> comingslist = parseArray(coming, WaitMVBean.DataBean.ComingBean.class);

        //测试是否解析数据成功
//        String strTest = comingslist.get(0).getCat();
//        Log.e("TAG", strTest + "222");

         //解析数据成功,设置适配器-->
       
        }

    }

第四步:解析数据成功后,创建并设置适配器,并传递相关数据

 //解析数据成功,设置适配器
            MyRecyclerAdapter adapter = new MyRecyclerAdapter( mContext,comingslist);
            recyclerView.setAdapter(adapter);

适配器:

public class MyRecyclerAdapter extends RecyclerView.Adapter {

    private final List<WaitMVBean.DataBean.ComingBean> comingslist;
    private final Context mContext;
    private final LayoutInflater mLayoutInflater;


    public MyRecyclerAdapter(Context mContext, List<WaitMVBean.DataBean.ComingBean> comingslist) {
        this.mContext = mContext;
        this.comingslist = comingslist;
        mLayoutInflater = LayoutInflater.from(mContext);
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new MyViewHolder(mLayoutInflater.inflate(R.layout.date_item, null));
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
        MyViewHolder myholder = (MyViewHolder) holder;
        myholder.setData(position);
    }

    @Override
    public int getItemCount() {
        return comingslist.size();
    }

    class MyViewHolder extends RecyclerView.ViewHolder {
        private TextView mv_name;
        private TextView mv_dec;
        private TextView mv_date;
        private ImageView imageView;

        public MyViewHolder(View itemView) {
            super(itemView);
            mv_name = (TextView) itemView.findViewById(R.id.mv_name);
            mv_dec = (TextView) itemView.findViewById(R.id.mv_dec);
            mv_date = (TextView) itemView.findViewById(R.id.mv_date);
            imageView = (ImageView) itemView.findViewById(R.id.image);
        }

        public void setData(int position) {
            WaitMVBean.DataBean.ComingBean coming = comingslist.get(position);

            String name = coming.getNm();
            mv_name.setText(name);

            String date = coming.getShowInfo();
            mv_date.setText(date);

            String dec = coming.getScm();
            mv_dec.setText(dec);

            //注:当你发下图片无法打开是,做个字符串替换即可
            String imagUrl = coming.getImg();
            String newImagUrl = imagUrl.replaceAll("w.h", "50.80");

            //使用Glide加载图片
            Glide.with(mContext)
                    .load(newImagUrl)
                    .into(imageView);
        }
    }
}
item的布局:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="#ffffff"
    android:gravity="center_vertical"
    android:orientation="horizontal">

    <ImageView
        android:id="@+id/image"
        android:layout_width="70dp"
        android:layout_height="110dp"
        android:layout_marginBottom="5dp"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="8dp"
        android:layout_marginTop="5dp" />

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginLeft="6dp"
        android:layout_weight="1"
        android:orientation="vertical">

        <TextView
            android:id="@+id/mv_name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="神奇動物在哪裏"
            android:textColor="#000000"
            android:textSize="15sp" />

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="观众"
                android:textColor="#55000000"
                android:textSize="14sp" />

            <TextView
                android:id="@+id/tv_people"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="9.0 "
                android:textColor="#FFCE42"
                android:textSize="18sp" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text=" | 专业"
                android:textColor="#55000000"
                android:textSize="14sp" />

            <TextView
                android:id="@+id/tv_professional"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="6.7"
                android:textColor="#FFCE42"
                android:textSize="18sp" />
        </LinearLayout>
        
        <TextView
            android:id="@+id/mv_dec"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp"
            android:text="神奇動物城,法師顯超能"
            android:textColor="#99000000"
            android:textSize="11sp" />

        <TextView
            android:id="@+id/mv_date"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:text="今天165家影院放映2088场"
            android:textColor="#99000000"
            android:textSize="11sp" />
    </LinearLayout>

</LinearLayout>

第五步:一定不能忘!!!

recycleView不仅要设置适配器还要设置布局管理者,否则图片不显示

GridLayoutManager manager = new GridLayoutManager(this, 1);
            recyclerView.setLayoutManager(manager);

此时RecyclerView简单的完成效果如下:




下面开始做 可推动的 悬浮导航栏:

第一步:首先我们来写一个类,它起标记的作用,来放每一个item的对应的悬浮栏的字符串

public class NameBean {
    String name;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}

第二步:自定义一个SectionDecoration 类 继承 RecyclerView的ItemDecoration

public class SectionDecoration extends RecyclerView.ItemDecoration {
    private static final String TAG = "SectionDecoration";

    private List<NameBean> dataList;

    private DecorationCallback callback;
    private TextPaint textPaint;
    private Paint paint;
    private int topGap;
    private int alignBottom;
    private Paint.FontMetrics fontMetrics;


    public SectionDecoration(List<NameBean> dataList, Context context, DecorationCallback decorationCallback) {
        Resources res = context.getResources();
        this.dataList = dataList;
        this.callback = decorationCallback;
        //设置悬浮栏的画笔---paint
        paint = new Paint();
        paint.setColor(res.getColor(R.color.colorGray));

        //设置悬浮栏中文本的画笔
        textPaint = new TextPaint();
        textPaint.setAntiAlias(true);
        textPaint.setTextSize(DensityUtil.dip2px(context, 14));
        textPaint.setColor(Color.DKGRAY);
        textPaint.setTextAlign(Paint.Align.LEFT);
        fontMetrics = new Paint.FontMetrics();
        //决定悬浮栏的高度等
        topGap = res.getDimensionPixelSize(R.dimen.sectioned_top);
        //决定文本的显示位置等
        alignBottom = res.getDimensionPixelSize(R.dimen.sectioned_alignBottom);
    }

    @Override
    public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
        super.getItemOffsets(outRect, view, parent, state);
        int pos = parent.getChildAdapterPosition(view);
        Log.i(TAG, "getItemOffsets:" + pos);
        String groupId = callback.getGroupId(pos);
        if (groupId.equals("-1")) return;
        //只有是同一组的第一个才显示悬浮栏
        if (pos == 0 || isFirstInGroup(pos)) {
            outRect.top = topGap;
            if (dataList.get(pos).getName() == "") {
                outRect.top = 0;
            }
        } else {
            outRect.top = 0;
        }
    }

    @Override
    public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
        super.onDraw(c, parent, state);
        int left = parent.getPaddingLeft();
        int right = parent.getWidth() - parent.getPaddingRight();
        int childCount = parent.getChildCount();
        for (int i = 0; i < childCount; i++) {
            View view = parent.getChildAt(i);
            int position = parent.getChildAdapterPosition(view);
            String groupId = callback.getGroupId(position);
            if (groupId.equals("-1")) return;
            String textLine = callback.getGroupFirstLine(position).toUpperCase();
            if (textLine == "") {
                float top = view.getTop();
                float bottom = view.getTop();
                c.drawRect(left, top, right, bottom, paint);
                return;
            } else {
                if (position == 0 || isFirstInGroup(position)) {
                    float top = view.getTop() - topGap;
                    float bottom = view.getTop();
                    //绘制悬浮栏
                    c.drawRect(left, top - topGap, right, bottom, paint);
                    //绘制文本
                    c.drawText(textLine, left, bottom, textPaint);
                }
            }
        }
    }

    @Override
    public void onDrawOver(Canvas c, RecyclerView parent, RecyclerView.State state) {
        super.onDrawOver(c, parent, state);
        int itemCount = state.getItemCount();
        int childCount = parent.getChildCount();
        int left = parent.getPaddingLeft();
        int right = parent.getWidth() - parent.getPaddingRight();
        float lineHeight = textPaint.getTextSize() + fontMetrics.descent;

        String preGroupId = "";
        String groupId = "-1";
        for (int i = 0; i < childCount; i++) {
            View view = parent.getChildAt(i);
            int position = parent.getChildAdapterPosition(view);

            preGroupId = groupId;
            groupId = callback.getGroupId(position);
            if (groupId.equals("-1") || groupId.equals(preGroupId)) continue;

            String textLine = callback.getGroupFirstLine(position).toUpperCase();
            if (TextUtils.isEmpty(textLine)) continue;

            int viewBottom = view.getBottom();
            float textY = Math.max(topGap, view.getTop());
            //下一个和当前不一样移动当前
            if (position + 1 < itemCount) {
                String nextGroupId = callback.getGroupId(position + 1);
                //组内最后一个view进入了header
                if (nextGroupId != groupId && viewBottom < textY) {
                    textY = viewBottom;
                }
            }
            //textY - topGap决定了悬浮栏绘制的高度和位置
            c.drawRect(left, textY - topGap, right, textY, paint);
            //left+2*alignBottom 决定了文本往左偏移的多少(加-->向左移)
            //textY-alignBottom  决定了文本往右偏移的多少  (减-->向上移)
            c.drawText(textLine, left + 2 * alignBottom, textY - alignBottom, textPaint);
        }
    }


    /**
     * 判断是不是组中的第一个位置
     *
     * @param pos
     * @return
     */
    private boolean isFirstInGroup(int pos) {
        if (pos == 0) {
            return true;
        } else {
            // 因为是根据 字符串内容的相同与否 来判断是不是同意组的,所以此处的标记id 要是String类型
            // 如果你只是做联系人列表,悬浮框里显示的只是一个字母,则标记id直接用 int 类型就行了
            String prevGroupId = callback.getGroupId(pos - 1);
            String groupId = callback.getGroupId(pos);
            //判断前一个字符串 与 当前字符串 是否相同
            if (prevGroupId.equals(groupId)) {
                return false;
            } else {
                return true;
            }
        }
    }

    //定义一个借口方便外界的调用
    interface DecorationCallback {
        String getGroupId(int position);

        String getGroupFirstLine(int position);
    }
}

第三步:在向list集合中先把每一个item的 起“标记”作用的字符串都加进去

setPullAction(comingslist);
private void setPullAction(List<WaitMVBean.DataBean.ComingBean> comingslist) {
        dataList = new ArrayList<>();

        for (int i = 0; i < comingslist.size(); i++) {
            NameBean nameBean = new NameBean();
            String name0 = comingslist.get(i).getComingTitle();
            nameBean.setName(name0);
            dataList.add(nameBean);
        }
    }



第四步:在setAdapter(),为RecyclerView添加ItemDecoration:

recyclerView.addItemDecoration(new SectionDecoration(dataList,mContext, new SectionDecoration.DecorationCallback() {
               //返回标记id (即每一项对应的标志性的字符串)
                @Override
                public String getGroupId(int position) {
                    if(dataList.get(position).getName()!=null) {
                        return dataList.get(position).getName();
                    }
                    return "-1";
                }

                //获取同组中的第一个内容
                @Override
                public String getGroupFirstLine(int position) {
                    if(dataList.get(position).getName()!=null) {
                        return dataList.get(position).getName();
                    }
                    return "";
                }
            }));

这样就完成了~

再看一眼最终效果感受一下:






















本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Android-使用RecyclerView的ItemDecoration 实现炫酷的 吸顶效果 的相关文章

  • μC/OS III - 任务调度 Ⅰ:调度过程和调度点

    这是 C OS III任务调度的第一篇文章 xff1a 调度过程和调度点 基于Cortex M系列的处理器 xff0c 从最简单的创建任务开始 xff0c 分析 C OS III的任务调度过程 包括上下文切换的详细过程 任务的栈分配详情 引
  • 使用CANAPE脚本script周期性发送报文

    1 新建一个drive 选择devices选项卡中的device configuration 选择device菜单 xff0c new一个新驱动CAN 名称可自定义 Next 配置通道 xff0c 导入DBC Next 选择CANAPE对应
  • 【图像处理】MATLAB:基本原理

    前言 兜兜转转 xff0c 越发意识到夯实基础的重要性 不积跬步无以至千里 xff0c 想要深入学习图像处理 xff0c 就得安下心来踏实学习 xff0c 掌握基本理论知识 xff0c 切不可再得过且过 吊儿郎当 谨记两个词 刻苦 创新 x
  • 【Kalman】卡尔曼滤波Matlab简单实现

    本节卡尔曼滤波Matlab实现是针对线性系统估计的 xff0c 仅为简单仿真 1 离散时间线性动态系统的状态方程 线性系统采用状态方程 观测方程及其初始条件来描述 线性离散时间系统的一般状态方程可描述为 其中 xff0c X k 是 k 时
  • 安装Airsim并在Airsim仿真环境下进行DDPG DQN强化学习算法无人机训练

    微软开源了基于虚幻4引擎的一款用于模拟无人机飞行的工具AirSim 用户可以用在虚幻引擎下模拟无人机的飞行并进行数据采集 非常适合做视觉算法的测试以及仿真环境的训练等等 xff0c 下面介绍如何快速使用次仿真环境完成project的运行和使
  • Android面试专题 (十一):显式Intent & 隐式Intent

    面试官 xff1a 来 xff0c 说一下Android中的显式Intent 和 隐式Intent吧 xff01 嗯 xff0c 乍一听觉得这么简单你让我说什么呢 xff1f 但是 xff0c 没办法 xff0c 面试往往面的就是基础不是嘛
  • Java设计模式 | 观察者模式解析与实战

    概述 观察者模式是一个使用率非常高的模式 xff0c 它最常用的地方是 GUI 系统 订阅 发布系统 这个模式的一个重要作用就是解耦 xff0c 将被观察者和观察者解耦 xff0c 使得它们之间的依赖性更小 xff0c 甚至做到毫无依赖 以
  • ISO 26262中的ASIL等级确定与分解

    ISO 26262中的ASIL等级确定与分解 1 引言 汽车上电子 电气系统 xff08 E E xff09 数量不断的增加 xff0c 一些高端豪华轿车上有多达70多个ECU xff08 Electronic Control Unit电子
  • 数字电路符号整理

    0 常见的数字电路符号 1 D触发器 这个就是D触发器的示意图 其中 xff0c clk为时钟 xff0c rst n为复位 xff0c d为输入 xff0c q为输出 这个功能非常简单 xff0c 复位有效的时候 xff0c 这个q的值你
  • 进程优先级详解(prio、static_prio、normal_prio、rt_priority)

    Linux 中采用了两种不同的优先级范围 xff0c 一种是 nice 值 xff0c 一种是实时优先级 在上一篇粗略的说了一下 nice 值和实时优先级 xff0c 仍有不少疑问 xff0c 本文来详细说明一下进程优先级 linux 内核
  • C++中struct和class

    在C 43 43 中我们可以看到struct和class的区别并不是很大 xff0c 两者之间有很大的相似性 那么为什么还要保留struct 这是因为C 43 43 是向下兼容的 xff0c 因此C 43 43 中保留了很多C的东西 一 首
  • Linux中的进程栈和线程栈

    转载自 xff1a Linux中的进程栈和线程栈 知乎 1 进程栈 进程栈是属于用户态栈 xff0c 和进程虚拟地址空间 Virtual Address Space 密切相关 那我们先了解下什么是虚拟地址空间 xff1a 在 32 位机器下
  • Linux内存管理(二):PTMalloc

    1 ptmalloc简介 2 内存管理数据结构 3 内存分配 4 内存回收 5 配置选项 6 注意事项 1 ptmalloc简介 Linux 中 malloc 的早期版本是由 Doug Lea 实现的 xff0c 它有一个重要问题就是在并行
  • P问题、NP问题、NP完全问题和NP难问题

    在讲P类问题之前先介绍两个个概念 xff1a 多项式 xff0c 时间复杂度 知道这两概念的可以自动跳过这部分 1 多项式 xff1a axn bxn 1 43 c 恩 就是长这个样子的 xff0c 叫x最高次为n的多项式 咳咳 xff0c
  • 电容基本知识

    旁路电容 xff0c 耦合电容 xff0c 电容不同类型的使用范围 在模拟和数字PCB设计中 xff0c 旁路或去耦电容 0 1uF 应尽量靠近器件 放置 供电电源去耦电容 10uF 应放置在电路板的电源线入口处 所有情 况下 xff0c
  • 最长递增子序列的三种算法

    转载自 xff1a http qiemengdao iteye com blog 1660229 最长递增子序列 问题 给定一个长度为N的数组 xff0c 找出一个最长的单调自增子序列 xff08 不一定连续 xff0c 但是顺序不能乱 x
  • 树莓派手动指定静态IP和DNS 终极解决大法

    在把玩树莓派的过程中 xff0c 往往需要手动给它设定一个静态的IP地址 xff0c 一来可以防范DHCP自动分配的IP来回变动 xff0c 导致远程SSH时常无法连接 xff1b 二来还可以提高树莓派的网络连接速度 对此菲菲君在网上查了很
  • Anroid面试专题(十二):图片大小的优化 及 三级缓存

    面试官 xff1a 你在项目中处理过图片吗 xff0c 说一下你是如何对它做优化的 xff0c 及三级缓存是什么 xff1f 我们可以这样一步一步来回答 xff1a 1 一张图的大小是怎么计算的 要回答这个问题 xff0c 我们要先从图片说
  • UART和RS232/RS485的关系是什么?

    串口通讯是电子工程师和嵌入式开发工程师面对的最基本问题 xff0c RS232则是其中最简单最常用的通讯方式 但是初学者往往搞不清有关的名词如UART和RS232或RS485之间是什么关系 xff0c 因为它们经常被放到语句中同等的位置使用
  • TensorBoard的使用

    介绍 使用 Tensorboard 是TF 的可视化工具 xff0c 它通过对Tensoflow程序运行过程中输出的日志文件进行可视化Tensorflow程序的运行状态 xff0c 如下所示 SCALARS 对标量数据进行汇总和记录 使用方

随机推荐

  • Tensorflow 多 GPU 训练

    介绍 TensorFlow中的并行主要分为模型并行和数据并行 模型并行需要根据不同模型设计不同的并行方式 xff0c 其主要原理是将模型中不同计算节点放在不同硬件资源上运算 比较通用的且能简便地实现大规模并行的方式是数据并行 xff0c 其
  • Hadoop 各组件介绍

    转自 https www cnblogs com klb561 p 9085615 html Hadoop是一个由Apache基金会所开发的分布式系统基础架构 用户可以在不了解分布式底层细节的情况下 xff0c 开发分布式程序 充分利用集群
  • 8、解决Linux无法上网的各种问题

    最近发现Linux重新开机后无法上网 xff0c 不仅不能ping通windows主机也不能上外网 ifconfig后eth0也没有分配IP地址 xff0c 总之各种问题都被我碰到了 现在来一一解决 xff01 1 没有分配到IP地址 开机
  • 解决开发板ping不通主机和虚拟机的问题

    使用TFTP和NFS从虚拟机下载文件或者制作根文件系统的前提是开发板能够ping同虚拟机 xff01 相信很多人都像我一样有过ping不通的经历 xff0c 经过2 3天的研究和实验后终于把问题解决了 xff0c 而且屡试不爽 最后得出结论
  • USB摄像头驱动配置及V4L2编程

    1 摄像头驱动开发 1 1 摄像头软件系统架构 摄像头系统架构分为四层 xff1a 摄像头 支持V4L2的摄像头驱动 V4L2核心 应用程序 V4L2核心是Linux系统自带的组件 xff0c 它可以屏蔽摄像头驱动层的差异 xff0c 不管
  • 机器学习中的五种回归模型及其优缺点

    转自https blog csdn net Katherine hsr article details 79942260 好像有部分公式不能显示 xff0c 请查看原博客 本文将会介绍五种常见的回归模型的概念及其优缺点 xff0c 包括线性
  • VGGNet介绍

    VGGNet介绍 1 简要概括 VGGNet由牛津大学计算机视觉组合和Google DeepMind公司研究员一起研发的深度卷积神经网络 它探索了卷积神经网络的深度和其性能之间的关系 xff0c 通过反复的堆叠3 3的小型卷积核和2 2的最
  • PX4编译问题总结

    PX4在变编译的时候总会碰到很多问题 有些问题根据提示就可以解决 xff0c 有些问题却有点麻烦 1 找不到python jinja2模块 CMake Error at usr share cmake 3 2 Modules FindPac
  • 面试专题(十三):Service 与 IntentService

    1 Service 与 IntentService区别 Service不是运行在独立的线程 xff0c 所以不建议在Service中编写耗时的逻辑和操作 xff0c 否则会引起ANR IntentService 1 可用于执行后台耗时的任务
  • ResNet介绍

    ResNet介绍 1 简要概括 ResNet xff08 Residual Neural Network xff09 由微软研究院的Kaiming He等四名华人提出 xff0c 通过使用ResNet Unit成功训练出了152层的神经网络
  • PX4日志生成及查看

    Pixhawk的飞行日志由固件中的sd2log模块记录在SD卡的log文件中 xff0c 目前版本的格式为 px4log xff08 曾经是 bin xff09 xff0c 根据sd2log的设置不同 xff0c 包含飞行日志的文件夹的名字
  • PX4中混控器Mixer的分析

    PX4架构保证了核心控制器中不需要针对机身布局做特别处理 混控指的是把输入指令 xff08 例如 xff1a 遥控器打右转 xff09 分配到电机以及舵机的执行器 xff08 如电调或舵机PWM xff09 指令 对于固定翼的副翼控制而言
  • PX4-固定翼的姿态控制

    下面分析代码的版本是v1 8 2 1 参数介绍 固定翼中有很多参数 xff0c 理解这些参数的含义非常重要 FW AIRSPD TRIM 巡航状态下的空速 15m s FW AIRSPD MIN 最小空速 10m s FW AIRSPD M
  • PX4子模块不一致的问题

    PX4新代码改变了很多东西 xff0c 同时子模块改变也挺大的 将主代码切换到较老版本时会发生子模块版本不符合的情况 xff0c 这时候需要注意 xff0c 切换后需要同步下子模块 make clean git checkout lt wh
  • 【乌拉喵.教程】串口服务器的配置与连接调试

    串口服务器型号 xff1a NSC6008 8 1 使用网线将PC与串口服务器进行连接 2 将PC的IP设为如下 3 使用光盘所带软件update exe找到与PC相连的串口服务器IP 点击图标修改串口服务器IP地址为10 116 2 20
  • 解决Linux-Ubuntu下网速慢的解决方法

    官网上下了一个新版的Ubuntu18 04 xff0c 发现这个版本的网络速度像乌龟一样 xff0c 查阅了很多人的博客都没有用 xff0c 很多都是解决关于浏览器慢的方法 但是 xff0c 这个系统慢的不是浏览器 xff0c 是接上WIF
  • FPGA---7系列之IBERT_GTX内外环测试

    一 概述 IBERT xff08 集成误码率测试仪 xff09 是xilinx为7系列FPGA GTX收发器设计的 xff0c 用于评估和监控GTX收发器 IBERT包括在FPGA逻辑中实现的模式生成器和检查器 xff0c 以及对端口的访问
  • FPGA之JESD204B接口——总体概要 尾片

    在上一篇博客中 JESD204B 1 总体概要 xff0c 我们框架性的介绍了JESD204B xff0c 这篇博客介绍协议所需要关注的一些参数 xff0c 这些参数基本就是决定了连接特性 理解这些参数 xff0c 有助于理解连接中的转换特
  • FPGA之JESD204B接口——总体概要 实例上

    JESD204B IP CORE结构 JESD204B支持速率高达12 5Gbps xff0c IPcore可以配置为发送端 xff08 如用于DAC xff09 或接收端 xff08 如用于ADC xff09 xff0c 每个core支持
  • Android-使用RecyclerView的ItemDecoration 实现炫酷的 吸顶效果

    转载请注明出处 xff1a 李诗雨 http blog csdn net cjm2484836553 article details 53453982 开始逐渐领略到 ItemDecoration的美 源码已上传至github xff0c