仿雷速体育app踢足球tab

news2024/9/21 12:31:27

MyTabLayout

MyTabLayout用法参照BaseLibrary的Demo
GitHub仓库地址

效果图

效果图

引入

gradle

allprojects {
    repositories {
        maven { url 'https://jitpack.io' }
    }
}

implementation 'com.github.DL-ZhangTeng:BaseLibrary:2.3.0'

属性

MyTabLayout属性名描述:可参考原生控件TabLayout
tabMyGravityGRAVITY_FILL充满屏幕、GRAVITY_CENTER居中
tabMyModeMODE_SCROLLABLE可滚动tab、MODE_FIXED固定tab
tabMyTypeface未被选中tab文本样式
tabMySelectedTypeface被选中tab文本样式
tabMyPaddingStart居左Padding
tabMyTextColor未选中文本颜色
tabMyPaddingEnd居右Padding
tabMySelectedTextColor被选中文本颜色
tabMyMaxWidth最大宽度
tabMyBackground背景色
tabMyTextAppearance文本样式
tabMyContentStarttabs距TabLayout开始位置的偏移量,只有tabMyMode
tabMyMinWidth最小宽度
tabMyPaddingBottom距底部Padding
tabMyPaddingTop距顶部Padding
tabMyPaddingPadding
tabMyTextIconGapText与Icon之间的margin
tabMyViewNumbertab数量
tabMySelectedTextSize被选中文字大小
tabMyTextSize未选中文字大小
tabMyTabViewSelfTabView自定义时宽度自适应
tabMyIndicatorWidth指示器宽度(设置宽度后指示器Margin失效)
tabMyIndicatorHeight指示器高度
tabMyIndicatorMarginLeft指示器居左Margin
tabMyIndicatorMarginTop指示器居顶部Margin
tabMyIndicatorMarginRight指示器居右Margin
tabMyIndicatorMarginBottom指示器居底部Margin
tabMyIndicatorSelfFit指示器宽度自适应文本宽度(默认false)
tabMyIndicatorMarginBottomSelfFit指示器自适应文本底部的距离(tabMyIndicatorSelfFit为true时生效,默认false)
tabMyIndicatorBottomLayer指示器置于文本底部(默认false)
tabMyIndicatorColor指示器颜色
tabMyIndicatorRoundRadius指示器圆角
tabMyIndicatorDrawable图片指示器,支持drawable与mipmap
tabMyIndicatorVerticalOffsets指示器垂直滚动,String数组对应每一个tab的垂直偏移量(0.0:不进行垂直偏移;1.0:垂直偏移tab高度-指示器高度-垂直Margin)
tabMyIndicatorHorizontalOffsets指示器水平滚动,String数组对应每一个tab的水平偏移量(0.0:不进行水平偏移;1.0:水平移tab宽度-指示器宽度-水平Margin)

示例

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <com.zhangteng.base.widget.MyTabLayout
        android:id="@+id/tab_layout"
        android:layout_width="match_parent"
        android:layout_height="40dp"
        app:tabMyBackground="@color/colorWhite"
        app:tabMyIndicatorBottomLayer="false"
        app:tabMyIndicatorColor="#ff000000"
        app:tabMyIndicatorHeight="2dp"
        app:tabMyIndicatorMarginBottomSelfFit="false"
        app:tabMyIndicatorRoundRadius="2dp"
        app:tabMyIndicatorSelfFit="false"
        app:tabMyMode="MODE_SCROLLABLE"
        app:tabMyPaddingEnd="18dp"
        app:tabMyPaddingStart="18dp"
        app:tabMySelectedTextColor="#222222"
        app:tabMySelectedTextSize="16sp"
        app:tabMySelectedTypeface="NORMAL"
        app:tabMyTabViewSelf="true"
        app:tabMyTextColor="#999999"
        app:tabMyTextSize="14sp"
        app:tabMyTypeface="NORMAL" />

    <com.zhangteng.base.widget.MyTabLayout
        android:id="@+id/tab_layout1"
        android:layout_width="match_parent"
        android:layout_height="40dp"
        app:tabMyBackground="@color/colorWhite"
        app:tabMyIndicatorBottomLayer="false"
        app:tabMyIndicatorColor="#00000000"
        app:tabMyIndicatorDrawable="@mipmap/ic_delete"
        app:tabMyIndicatorHeight="15dp"
        app:tabMyIndicatorMarginBottomSelfFit="false"
        app:tabMyIndicatorRoundRadius="2dp"
        app:tabMyIndicatorSelfFit="false"
        app:tabMyIndicatorWidth="15dp"
        app:tabMyMode="MODE_SCROLLABLE"
        app:tabMyPaddingEnd="18dp"
        app:tabMyPaddingStart="18dp"
        app:tabMySelectedTextColor="#222222"
        app:tabMySelectedTextSize="16sp"
        app:tabMySelectedTypeface="NORMAL"
        app:tabMyTabViewSelf="true"
        app:tabMyTextColor="#999999"
        app:tabMyTextSize="14sp"
        app:tabMyTypeface="NORMAL" />

    <com.zhangteng.base.widget.MyTabLayout
        android:id="@+id/tab_layout2"
        android:layout_width="match_parent"
        android:layout_height="40dp"
        app:tabMyBackground="@color/colorWhite"
        app:tabMyIndicatorBottomLayer="false"
        app:tabMyIndicatorColor="#ff000000"
        app:tabMyIndicatorHeight="2dp"
        app:tabMyIndicatorMarginBottomSelfFit="false"
        app:tabMyIndicatorMarginLeft="5dp"
        app:tabMyIndicatorMarginRight="5dp"
        app:tabMyIndicatorRoundRadius="2dp"
        app:tabMyIndicatorSelfFit="false"
        app:tabMyMode="MODE_SCROLLABLE"
        app:tabMyPaddingEnd="18dp"
        app:tabMyPaddingStart="18dp"
        app:tabMySelectedTextColor="#222222"
        app:tabMySelectedTextSize="16sp"
        app:tabMySelectedTypeface="NORMAL"
        app:tabMyTabViewSelf="true"
        app:tabMyTextColor="#999999"
        app:tabMyTextSize="14sp"
        app:tabMyTypeface="NORMAL" />

    <com.zhangteng.base.widget.MyTabLayout
        android:id="@+id/tab_layout3"
        android:layout_width="match_parent"
        android:layout_height="40dp"
        app:tabMyBackground="@color/colorWhite"
        app:tabMyIndicatorBottomLayer="true"
        app:tabMyIndicatorColor="#ff000000"
        app:tabMyIndicatorHeight="2dp"
        app:tabMyIndicatorMarginBottomSelfFit="true"
        app:tabMyIndicatorRoundRadius="2dp"
        app:tabMyIndicatorSelfFit="true"
        app:tabMyMode="MODE_SCROLLABLE"
        app:tabMyPaddingEnd="18dp"
        app:tabMyPaddingStart="18dp"
        app:tabMySelectedTextColor="#222222"
        app:tabMySelectedTextSize="16sp"
        app:tabMySelectedTypeface="NORMAL"
        app:tabMyTabViewSelf="true"
        app:tabMyTextColor="#999999"
        app:tabMyTextSize="14sp"
        app:tabMyTypeface="NORMAL" />

    <com.zhangteng.base.widget.MyTabLayout
        android:id="@+id/tab_layout4"
        android:layout_width="match_parent"
        android:layout_height="40dp"
        app:tabMyBackground="@color/colorWhite"
        app:tabMyIndicatorBottomLayer="true"
        app:tabMyIndicatorColor="#ff000000"
        app:tabMyIndicatorHeight="2dp"
        app:tabMyIndicatorMarginBottomSelfFit="true"
        app:tabMyIndicatorRoundRadius="2dp"
        app:tabMyIndicatorSelfFit="true"
        app:tabMyMode="MODE_FIXED"
        app:tabMyPaddingEnd="18dp"
        app:tabMyPaddingStart="18dp"
        app:tabMySelectedTextColor="#222222"
        app:tabMySelectedTextSize="16sp"
        app:tabMySelectedTypeface="NORMAL"
        app:tabMyTabViewSelf="true"
        app:tabMyTextColor="#999999"
        app:tabMyTextSize="14sp"
        app:tabMyTypeface="NORMAL"
        app:tabMyViewNumber="5" />

    <com.zhangteng.base.widget.MyTabLayout
        android:id="@+id/tab_layout5"
        android:layout_width="match_parent"
        android:layout_height="40dp"
        app:tabMyBackground="@color/colorWhite"
        app:tabMyIndicatorBottomLayer="true"
        app:tabMyIndicatorColor="#ff000000"
        app:tabMyIndicatorHeight="2dp"
        app:tabMyIndicatorMarginBottomSelfFit="true"
        app:tabMyIndicatorRoundRadius="2dp"
        app:tabMyIndicatorSelfFit="true"
        app:tabMyMode="MODE_FIXED"
        app:tabMySelectedTextColor="#222222"
        app:tabMySelectedTextSize="26sp"
        app:tabMySelectedTypeface="NORMAL"
        app:tabMyTabViewSelf="true"
        app:tabMyTextColor="#999999"
        app:tabMyTextSize="14sp"
        app:tabMyTypeface="NORMAL"
        app:tabMyViewNumber="5" />

    <com.zhangteng.base.widget.MyTabLayout
        android:id="@+id/tab_layout6"
        android:layout_width="match_parent"
        android:layout_height="42dp"
        app:tabMyBackground="@color/colorWhite"
        app:tabMyIndicatorBottomLayer="false"
        app:tabMyIndicatorColor="#00000000"
        app:tabMyIndicatorDrawable="@mipmap/icon_match_event_goal_mini"
        app:tabMyIndicatorHeight="10dp"
        app:tabMyIndicatorHorizontalOffsets="@array/HorizontalOffset"
        app:tabMyIndicatorMarginBottomSelfFit="false"
        app:tabMyIndicatorRoundRadius="2dp"
        app:tabMyIndicatorSelfFit="false"
        app:tabMyIndicatorVerticalOffsets="@array/VerticalOffset"
        app:tabMyIndicatorWidth="10dp"
        app:tabMyMode="MODE_FIXED"
        app:tabMyPaddingEnd="18dp"
        app:tabMyPaddingStart="18dp"
        app:tabMySelectedTextColor="#222222"
        app:tabMySelectedTextSize="16sp"
        app:tabMySelectedTypeface="NORMAL"
        app:tabMyTabViewSelf="true"
        app:tabMyTextColor="#999999"
        app:tabMyTextSize="14sp"
        app:tabMyTypeface="NORMAL"
        app:tabMyViewNumber="5" />

    <com.zhangteng.base.widget.MyTabLayout
        android:id="@+id/tab_layout7"
        android:layout_width="match_parent"
        android:layout_height="42dp"
        app:tabMyBackground="@color/colorWhite"
        app:tabMyIndicatorBottomLayer="false"
        app:tabMyIndicatorColor="#00000000"
        app:tabMyIndicatorDrawable="@mipmap/icon_match_event_goal_mini"
        app:tabMyIndicatorHeight="10dp"
        app:tabMyIndicatorHorizontalOffsets="@array/HorizontalOffset"
        app:tabMyIndicatorMarginBottomSelfFit="false"
        app:tabMyIndicatorRoundRadius="2dp"
        app:tabMyIndicatorSelfFit="false"
        app:tabMyIndicatorVerticalOffsets="@array/VerticalOffset"
        app:tabMyIndicatorWidth="10dp"
        app:tabMyMode="MODE_FIXED"
        app:tabMyPaddingEnd="18dp"
        app:tabMyPaddingStart="18dp"
        app:tabMySelectedTextColor="#222222"
        app:tabMySelectedTextSize="16sp"
        app:tabMySelectedTypeface="NORMAL"
        app:tabMyTabViewSelf="true"
        app:tabMyTextColor="#999999"
        app:tabMyTextSize="14sp"
        app:tabMyTypeface="NORMAL"
        app:tabMyViewNumber="5" />

    <androidx.viewpager.widget.ViewPager
        android:id="@+id/vp"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</LinearLayout>
package com.zhangteng.baselibrary.activity

import android.graphics.drawable.AnimationDrawable
import android.os.Bundle
import android.widget.ImageView
import androidx.fragment.app.Fragment
import androidx.viewpager.widget.ViewPager
import com.zhangteng.base.adapter.CommonFragmentAdapter
import com.zhangteng.base.base.BaseActivity
import com.zhangteng.base.widget.MyTabLayout
import com.zhangteng.base.widget.MyTabLayoutMediator
import com.zhangteng.baselibrary.R
import com.zhangteng.baselibrary.fragment.BaseDemoFragment


class TabLayoutActivity : BaseActivity() {
    private var tab_layout: MyTabLayout? = null
    private var tab_layout1: MyTabLayout? = null
    private var tab_layout2: MyTabLayout? = null
    private var tab_layout3: MyTabLayout? = null
    private var tab_layout4: MyTabLayout? = null
    private var tab_layout5: MyTabLayout? = null
    private var tab_layout6: MyTabLayout? = null
    private var tab_layout7: MyTabLayout? = null
    private var vp: ViewPager? = null
    private val titleList: Array<String?> =
        arrayOf("111111", "111111", "111111", "111111", "111111")

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_tablayout)
    }

    override fun initView() {
        tab_layout = findViewById(R.id.tab_layout)
        tab_layout1 = findViewById(R.id.tab_layout1)
        tab_layout2 = findViewById(R.id.tab_layout2)
        tab_layout3 = findViewById(R.id.tab_layout3)
        tab_layout4 = findViewById(R.id.tab_layout4)
        tab_layout5 = findViewById(R.id.tab_layout5)
        tab_layout6 = findViewById(R.id.tab_layout6)
        tab_layout7 = findViewById(R.id.tab_layout7)
        vp = findViewById(R.id.vp)

        val fragments = ArrayList<Fragment>()
        fragments.add(BaseDemoFragment())
        fragments.add(BaseDemoFragment())
        fragments.add(BaseDemoFragment())
        fragments.add(BaseDemoFragment())
        fragments.add(BaseDemoFragment())
        vp?.adapter =
            CommonFragmentAdapter(
                supportFragmentManager,
                titleList,
                fragments
            )

        tab_layout?.setupWithViewPager(vp)
        tab_layout1?.setupWithViewPager(vp)
        tab_layout2?.setupWithViewPager(vp)
        tab_layout3?.setupWithViewPager(vp)
        tab_layout4?.setupWithViewPager(vp)
        tab_layout5?.setupWithViewPager(vp)

        //使用newTab()自定义Tab
        for (position in titleList.indices) {
            val tab = tab_layout6?.newTab()
            tab?.let {
                val imageView = ImageView(this@TabLayoutActivity)
                setAnimation(imageView, position)
                tab.setCustomView(imageView)
                tab_layout6?.addTab(tab)
                if (position == 0) {
                    val animationDrawable =
                        (tab.getCustomView() as ImageView).drawable as AnimationDrawable?
                    if (animationDrawable != null && !animationDrawable.isRunning) {
                        animationDrawable.start()
                    }
                }
            }
        }
        vp?.addOnPageChangeListener(MyTabLayout.TabLayoutOnPageChangeListener(tab_layout6))

        tab_layout6?.addOnTabSelectedListener(object : MyTabLayout.OnTabSelectedListener {
            override fun onTabSelected(tab: MyTabLayout.Tab?) {
                tab?.let {
                    vp?.currentItem = tab.getPosition()

                    val animationDrawable =
                        (tab.getCustomView() as ImageView).drawable as AnimationDrawable?
                    if (animationDrawable != null && !animationDrawable.isRunning) {
                        animationDrawable.start()
                    }
                }
            }

            override fun onTabUnselected(tab: MyTabLayout.Tab?) {
                tab?.let {
                    setAnimation(tab.getCustomView() as ImageView, tab.getPosition())
                }
            }

            override fun onTabReselected(tab: MyTabLayout.Tab?) {
                tab?.let {
                    setAnimation(tab.getCustomView() as ImageView, tab.getPosition())
                }
            }
        })

        //使用MyTabLayoutMediator自定义Tab
        MyTabLayoutMediator(
            tab_layout7!!,
            vp!!,
            object : MyTabLayoutMediator.TabConfigurationStrategy {
                override fun onConfigureTab(tab: MyTabLayout.Tab, position: Int) {
                    val imageView = ImageView(this@TabLayoutActivity)
                    setAnimation(imageView, position)
                    tab.setCustomView(imageView)
                    if (position == 0) {
                        val animationDrawable =
                            (tab.getCustomView() as ImageView).drawable as AnimationDrawable?
                        if (animationDrawable != null && !animationDrawable.isRunning) {
                            animationDrawable.start()
                        }
                    }
                }
            })
            .attach()

        tab_layout7?.addOnTabSelectedListener(object : MyTabLayout.OnTabSelectedListener {
            override fun onTabSelected(tab: MyTabLayout.Tab?) {
                tab?.let {
                    val animationDrawable =
                        (tab.getCustomView() as ImageView).drawable as AnimationDrawable?
                    if (animationDrawable != null && !animationDrawable.isRunning) {
                        animationDrawable.start()
                    }
                }
            }

            override fun onTabUnselected(tab: MyTabLayout.Tab?) {
                tab?.let {
                    setAnimation(tab.getCustomView() as ImageView, tab.getPosition())
                }
            }

            override fun onTabReselected(tab: MyTabLayout.Tab?) {
                tab?.let {
                    setAnimation(tab.getCustomView() as ImageView, tab.getPosition())
                }
            }
        })
    }

    override fun initData() {

    }

    private fun setAnimation(imageView: ImageView, position: Int) {
        when (position) {
            0 -> {
                imageView.setImageResource(R.drawable.tab_animation_1)
            }
            1 -> {
                imageView.setImageResource(R.drawable.tab_animation_2)
            }
            2 -> {
                imageView.setImageResource(R.drawable.tab_animation_3)
            }
            3 -> {
                imageView.setImageResource(R.drawable.tab_animation_4)
            }
            4 -> {
                imageView.setImageResource(R.drawable.tab_animation_5)
            }
        }
    }
}

足球Tab动画与偏移数组

<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
    android:oneshot="true">
    <!-- animation-list 帧动画 -->
    <!-- android:oneshot的值为 false代表播放多次,true代表只播放一次 -->
    <!-- duration代表每张图片的播放时间 ,定义一个持续时间为50毫秒的动画帧 -->
    <item
        android:drawable="@mipmap/icon_match_1"
        android:duration="150" />
    <item
        android:drawable="@mipmap/icon_match_2"
        android:duration="150" />
    <item
        android:drawable="@mipmap/icon_match_3"
        android:duration="50" />
    <item
        android:drawable="@mipmap/icon_match_4"
        android:duration="50" />
</animation-list>
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string-array name="VerticalOffset">
        <item>0.258</item>
        <item>0.258</item>
        <item>0.254</item>
        <item>0.760</item>
        <item>0.258</item>
    </string-array>
    <string-array name="HorizontalOffset">
        <item>-0.058</item>
        <item>-0.058</item>
        <item>0.054</item>
        <item>0.066</item>
        <item>0.066</item>
    </string-array>
</resources>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/80076.html

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

相关文章

Chat GPT使用体验,它真的好厉害!!!

最近的chat GTP很火&#xff0c;起因是OpenAI发布了一个全新的聊天机器人模型。就连马斯克也在感叹“很多人疯狂地陷入了 ChatGPT 循环中”&#xff0c;“ChatGPT 好得吓人&#xff0c;我们离强大到危险的人工智能不远了”。 官方的介绍是&#xff0c;这一模型可以与人类进行谈…

人类特有本能:保护族群老弱病残

人有哪些特有的本能&#xff1f; - 知乎 对于动物群体来说&#xff0c;受伤了就不管了&#xff0c;自生自灭。对于人类来说&#xff0c;受伤了尽量照顾恢复。这看起来吃亏&#xff0c;实际上划算。一个成年人&#xff0c;长大需要20年&#xff0c;受伤恢复只要3个月。 远方青木…

全新CorelDRAW2023最新版矢量图软件功能简介

CorelDRAW2023简介 &#xff1a;设计绘画 CorelDraw 是一个绘图与排版的软件&#xff0c;它广泛地应用于商标设计、标志制作、模型绘制、插图描画、排版及分色输出等诸多领域。 作为一个强大的绘图软件&#xff0c;它被喜爱的程度可用下面的事实说明&#xff1a;用作商业设计和…

WPFUI LiveCharts使用记录(一)柱状图

前言&#xff1a;LiveCharts是一个图标控件库集&#xff0c;可以实现柱状图、折线图、饼图、仪表盘等图表控件。而且最新版本支持全平台使用&#xff0c;实现的样例展示可以点击查看作者Alberto Rodrguez的 github仓库 1.背景 1.1 新建项目 这篇文章使用的是.NET framework4.…

Foxmail升级后图片链接乱

升级后默认勾选了总是以纯文本格式阅读邮件。 在设置-高级-中取消勾选

ZooKeeper组件的核心知识总结,吐血总结,一文带你学会

文章目录数据模型数据存储Watch机制会话机制ACL权限序列化方式集群ZAB协议日志清理实现分布式锁实现分布式ID实现负载均衡开源框架使用案例Zookeeper 基本介绍Apache ZooKeeper 是由Apache Hadoop的子项目发展而来&#xff0c;为分布式应用提供高效且可靠的分布式协调服务。 在…

java计算机毕业设计ssm医院管理系统3w16k(附源码、数据库)

java计算机毕业设计ssm医院管理系统3w16k&#xff08;附源码、数据库&#xff09; 项目运行 环境配置&#xff1a; Jdk1.8 Tomcat8.5 Mysql HBuilderX&#xff08;Webstorm也行&#xff09; Eclispe&#xff08;IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持&#xff09;。…

【应用】OPC 通讯协议

OPC 通讯协议OPC 通讯协议基础OPC 简介OPC 与 OPC UAOPC 逻辑对象模型OPC 通信方式Java 实现 OPC 的方式Java 实现 OPC-clientOPC-DAOPC-UA模拟数据进行代码测试OPC-DA 代码验证OPC-UA 代码验证OPC 通讯协议基础 OPC 简介 OPC 全称 OLE For Process Control&#xff0c;即用于…

8. 发布确认高级

二八佳人体似酥&#xff0c;腰间仗剑斩愚夫。虽然不见人头落&#xff0c;暗里教君骨髓枯。 在生产环境中由于一些不明原因&#xff0c;导致 rabbitmq 重启&#xff0c;在 RabbitMQ重启期间生产者消息投递失败&#xff0c; 导致消息丢失&#xff0c;需要手动处理和恢复。于是&am…

PyQt - 使用多线程避免界面卡顿

PYQT作为界面程序包&#xff0c;为Pythoner快速构建界面&#xff0c;提供了便利性。特别是结合Pycharm扩展工具&#xff08;QTdesigner&#xff09;能够通过“拖拖拽拽”的方式构建简单界面。通过UIC将UI文件快速转化为PY文件&#xff0c;节省了时间。 PYQT的项目实践&#xff…

痞子衡嵌入式:我被邀请做贸泽电子与非网联合推出的《对话工程师》节目嘉宾...

《对话工程师》是「贸泽电子」赞助、「与非网」制作的一档网络节目&#xff0c;自2022年11月起&#xff0c;邀请不同技术领域的资深工程师&#xff0c;聊聊开发过程中的经验感悟&#xff0c;栏目共 10 期&#xff0c;痞子衡有幸被邀请做了第 4 期节目的嘉宾(12月5日在 「B站 - …

COVID

不信谣不传谣&#xff0c;只是自己的一点记录&#xff0c;有引用到各位大佬的内容&#xff0c;侵删&#xff0c;感谢感谢&#xff0c;对自己可以理中客&#xff0c;对别人还是尽可能主观上的友好&#xff0c;不要慷他人之慨。 准备 喉咙刺痛方面&#xff1a;柠檬&#xff08;…

Python爬虫实战,requests+openpyxl模块,爬取手机商品信息数据(附源码)

前言 今天给大家介绍的是Python爬取手机商品信息数据&#xff0c;在这里给需要的小伙伴们代码&#xff0c;并且给出一点小心得。 首先是爬取之前应该尽可能伪装成浏览器而不被识别出来是爬虫&#xff0c;基本的是加请求头&#xff0c;但是这样的纯文本数据爬取的人会很多&…

读《冯诺伊曼传》

关于冯诺依曼几年前读了本冯诺依曼的书&#xff0c;冯诺依曼是20世纪的全才&#xff0c;原名约翰尼&#xff0c;匈牙利美籍科学家&#xff0c;被称为计算机之父和博弈论之父。计算机和博弈论都深刻改变人类的生活工作和思维方式&#xff0c;极大地促进了社会和人类文明的进步发…

CMake中add_definitions/add_compile_definitions的使用

CMake中的add_definitions命令用于在源文件的编译中添加-D定义标志&#xff0c;其格式如下&#xff1a; add_definitions(-DFOO -DBAR ...) 将当前目录中的target的定义添加到编译器命令行(compiler command line)中,无论是在调用此命令之前还是之后添加的,还是之后添加的子目…

C/C++入门004-C语言流程控制

文章目录流程控制顺序结构:选择结构if选择结构switch选择循环结构while循环do whilefor循环循环优化四大跳转break:continuegotoreturn案例参考&#xff1a;https://blog.csdn.net/weixin_44617968/article/details/117656810 流程控制 控制流程&#xff08;也称为流程控制&a…

HC-05蓝牙模块AT指令 ERROR问题

AT模式指令识别貌似有些问题,但不知道什么原因导致的&#xff0c;返回正常值后&#xff0c;一切通信正常。 查了一些资料&#xff0c;觉得下面两个最靠谱。 1.引脚电平问题 2.需要3.3v接EN引脚 等到故障再次发生&#xff0c;尝试EN接3.3V&#xff0c;数据收发一切正常。 结论&…

acwing基础课——bellman-ford

由数据范围反推算法复杂度以及算法内容 - AcWing 常用代码模板3——搜索与图论 - AcWing 基本思想&#xff1a; 逐遍的对图中每一个边去迭代计算起始点到其余各点的最短路径&#xff0c;执行n-1遍&#xff0c;最终得到起始点到其余各点的最短路径。&#xff08;n为连通图结点数…

CEF使用 libcef_dll_wrapper Debug版链接报错

编译后使用Release版编译链接运行正常&#xff0c;而Debug版报错如下&#xff1a; libcef_dll_wrapper.lib(cef_logging.obj) : error LNK2038: 检测到“_ITERATOR_DEBUG_LEVEL”的不匹配项: 值“0”不匹配值“2”(CefAppEx.obj 中)具体原因是Debug版使用了Release版的库&…

图形化跟踪个股RPS走势,挖掘出源源不断的牛股!股票量化分析工具QTYX-V2.5.7...

概述RPS选股策略威廉欧奈尔把投资理念集中于他自创的CANSLIM选股系统&#xff0c;凭借着这个系统驰骋股票市场数十年&#xff0c;无论在牛市还是熊市&#xff0c;这个系统都是最稳定、表现最好的系统之一。CANSLIM选股系统中有一个RPS指标&#xff08;Relative Price Strength …