[已解决] BageView 在Android 5.0 之后出现了小红点显示在view 的后面的情况

Android仿微信未读消息数提示数字之BadgeView的使用 没事在整理以前上班收藏的一些笔记,发现其中的关键字部分有个 BadgeView 不知道是什么东东,于是乎搜了下,发现也是一个项目中很常用的功能。比如: 这样的,很常见。 这是官方的demo效果 :https://github.com/qstumn/BadgeView一些特性 随意定制外观,包括Badge位置、底色、边框、阴影、文字颜色(支持透明色)、大小、内外边距等 Badge数字小于0时显示dot 阅读详情

BageView 在Android 5.0 之后出现了小红点显示在view 的后面的情况。

原因分析:

在Android 5.0 之后使用了Material Design。这里面引入了高度的概念,所以如果view 是Button,那么该Button 在未点击的时候默认的是有一个高度的,

参考:http://blog.youkuaiyun.com/rodulf/article/details/68593779  


解决办法:

判断如果是5.0之后的版本,那么就给BageView 添加一个高度  


  1. //如果android 的版本大于21,也就是5.0以上的时候,去设置Elevation 和TranslationZ  
  2.            if(Build.VERSION.SDK_INT>21){  
  3.                this.setElevation(100);  
  4.                this.setTranslationZ(100);  
  5.            }  

	private void applyTo(View target) {
		
		LayoutParams lp = target.getLayoutParams();
		ViewParent parent = target.getParent();
		FrameLayout container = new FrameLayout(context);
		
		if (target instanceof TabWidget) {
			
			// set target to the relevant tab child container
			target = ((TabWidget) target).getChildTabViewAt(targetTabIndex);
			this.target = target;
			
			((ViewGroup) target).addView(container, 
					new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
			
			this.setVisibility(View.GONE);
			container.addView(this);
			
		} else {
			
			// TODO verify that parent is indeed a ViewGroup
			ViewGroup group = (ViewGroup) parent; 
			int index = group.indexOfChild(target);
			
			group.removeView(target);
			group.addView(container, index, lp);
			
			container.addView(target);
	
			this.setVisibility(View.GONE);
			container.addView(this);
            //如果android 的版本大于21,也就是5.0以上的时候,去设置Elevation 和TranslationZ
            if(Build.VERSION.SDK_INT>21){
                this.setElevation(100);
                this.setTranslationZ(100);
            }
			
			group.invalidate();
			
		}
		
	}




全部的代码:

import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.PixelFormat;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.ViewParent;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.DecelerateInterpolator;
import android.widget.FrameLayout;
import android.widget.TabWidget;
import android.widget.TextView;

/**
 * A simple text label view that can be applied as a "badge" to any given {@link View}.
 * This class is intended to be instantiated at runtime rather than included in XML layouts.
 * 
 * @author Jeff Gilfelt
 */
public class BadgeView extends TextView {

	public static final int POSITION_TOP_LEFT = 1;
	public static final int POSITION_TOP_RIGHT = 2;
	public static final int POSITION_BOTTOM_LEFT = 3;
	public static final int POSITION_BOTTOM_RIGHT = 4;
	public static final int POSITION_CENTER = 5;
	
	private static final int DEFAULT_MARGIN_DIP = 5;
	private static final int DEFAULT_LR_PADDING_DIP = 5;
	private static final int DEFAULT_CORNER_RADIUS_DIP = 8;
	private static final int DEFAULT_POSITION = POSITION_TOP_RIGHT;
	private static final int DEFAULT_BADGE_COLOR = Color.parseColor("#CCFF0000"); //Color.RED;
	private static final int DEFAULT_TEXT_COLOR = Color.WHITE;
	
	private static Animation fadeIn;
	private static Animation fadeOut;
	
	private Context context;
	private View target;
	
	private int badgePosition;
	private int badgeMarginH;
	private int badgeMarginV;
	private int badgeColor;
	
	private boolean isShown;
	
	private Drawable badgeBg;
	
	private int targetTabIndex;
    private Paint paint;
	
	public BadgeView(Context context) {
		this(context, (AttributeSet) null, android.R.attr.textViewStyle);
	}
	
	public BadgeView(Context context, AttributeSet attrs) {
		 this(context, attrs, android.R.attr.textViewStyle);
	}
	
	/**
     * Constructor -
     * 
     * create a new BadgeView instance attached to a target {@link View}.
     *
     * @param context context for this view.
     * @param target the View to attach the badge to.
     */
	public BadgeView(Context context, View target) {
		 this(context, null, android.R.attr.textViewStyle, target, 0);
	}
	
	/**
     * Constructor -
     * 
     * create a new BadgeView instance attached to a target {@link TabWidget}
     * tab at a given index.
     *
     * @param context context for this view.
     * @param target the TabWidget to attach the badge to.
     * @param index the position of the tab within the target.
     */
	public BadgeView(Context context, TabWidget target, int index) {
		this(context, null, android.R.attr.textViewStyle, target, index);
	}
	
	public BadgeView(Context context, AttributeSet attrs, int defStyle) {
		this(context, attrs, defStyle, null, 0);
	}
	
	public BadgeView(Context context, AttributeSet attrs, int defStyle, View target, int tabIndex) {
		super(context, attrs, defStyle);
		init(context, target, tabIndex);
	}

	private void init(Context context, View target, int tabIndex) {

	    paint=new Paint(badgeColor);
	    paint.setAntiAlias(true);

		this.context = context;
		this.target = target;
		this.targetTabIndex = tabIndex;
		
		// apply defaults
		badgePosition = DEFAULT_POSITION;
//		badgeMarginH = dipToPixels(DEFAULT_MARGIN_DIP);
		badgeMarginH = dipToPixels(0);
		badgeMarginV = badgeMarginH;
		badgeColor = DEFAULT_BADGE_COLOR;
		
		setTypeface(Typeface.DEFAULT_BOLD);
		int paddingPixels = dipToPixels(DEFAULT_LR_PADDING_DIP);
		setPadding(paddingPixels, 0, paddingPixels, 0);
		setTextColor(DEFAULT_TEXT_COLOR);
		
		fadeIn = new AlphaAnimation(0, 1);
		fadeIn.setInterpolator(new DecelerateInterpolator());
		fadeIn.setDuration(200);

		fadeOut = new AlphaAnimation(1, 0);
		fadeOut.setInterpolator(new AccelerateInterpolator());
		fadeOut.setDuration(200);
		
		isShown = false;
		
		if (this.target != null) {
			applyTo(this.target);
		} else {
			show();
		}

	}

	private void applyTo(View target) {
		
		LayoutParams lp = target.getLayoutParams();
		ViewParent parent = target.getParent();
		FrameLayout container = new FrameLayout(context);
		
		if (target instanceof TabWidget) {
			
			// set target to the relevant tab child container
			target = ((TabWidget) target).getChildTabViewAt(targetTabIndex);
			this.target = target;
			
			((ViewGroup) target).addView(container, 
					new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
			
			this.setVisibility(View.GONE);
			container.addView(this);
			
		} else {
			
			// TODO verify that parent is indeed a ViewGroup
			ViewGroup group = (ViewGroup) parent; 
			int index = group.indexOfChild(target);
			
			group.removeView(target);
			group.addView(container, index, lp);
			
			container.addView(target);
	
			this.setVisibility(View.GONE);
			container.addView(this);
            //如果android 的版本大于21,也就是5.0以上的时候,去设置Elevation 和TranslationZ
            if(Build.VERSION.SDK_INT>21){
                this.setElevation(100);
                this.setTranslationZ(100);
            }
			
			group.invalidate();
			
		}
		
	}
	
	/**
     * Make the badge visible in the UI.
     * 
     */
	public void show() {
		show(false, null);
	}
	
	/**
     * Make the badge visible in the UI.
     *
     * @param animate flag to apply the default fade-in animation.
     */
	public void show(boolean animate) {
		show(animate, fadeIn);
	}
	
	/**
     * Make the badge visible in the UI.
     *
     * @param anim Animation to apply to the view when made visible.
     */
	public void show(Animation anim) {
		show(true, anim);
	}
	
	/**
     * Make the badge non-visible in the UI.
     * 
     */
	public void hide() {
		hide(false, null);
	}
	
	/**
     * Make the badge non-visible in the UI.
     *
     * @param animate flag to apply the default fade-out animation.
     */
	public void hide(boolean animate) {
		hide(animate, fadeOut);
	}
	
	/**
     * Make the badge non-visible in the UI.
     *
     * @param anim Animation to apply to the view when made non-visible.
     */
	public void hide(Animation anim) {
		hide(true, anim);
	}
	
	/**
     * Toggle the badge visibility in the UI.
     * 
     */
	public void toggle() {
		toggle(false, null, null);
	}
	
	/**
     * Toggle the badge visibility in the UI.
     * 
     * @param animate flag to apply the default fade-in/out animation.
     */
	public void toggle(boolean animate) {
		toggle(animate, fadeIn, fadeOut);
	}
	
	/**
     * Toggle the badge visibility in the UI.
     *
     * @param animIn Animation to apply to the view when made visible.
     * @param animOut Animation to apply to the view when made non-visible.
     */
	public void toggle(Animation animIn, Animation animOut) {
		toggle(true, animIn, animOut);
	}
	
	private void show(boolean animate, Animation anim) {
		if (getBackground() == null) {
			if (badgeBg == null) {
				badgeBg = getDefaultBackground();
			}
			setBackgroundDrawable(badgeBg);
		}
		applyLayoutParams();
		
		if (animate) {
			this.startAnimation(anim);
		}
		this.setVisibility(View.VISIBLE);
		isShown = true;
	    invalidate();
	}



    private void hide(boolean animate, Animation anim) {
		this.setVisibility(View.GONE);
		if (animate) {
			this.startAnimation(anim);
		}
		isShown = false;
	}
	
	private void toggle(boolean animate, Animation animIn, Animation animOut) {
		if (isShown) {
			hide(animate && (animOut != null), animOut);	
		} else {
			show(animate && (animIn != null), animIn);
		}
	}
	
	/**
     * Increment the numeric badge label. If the current badge label cannot be converted to
     * an integer value, its label will be set to "0".
     * 
     * @param offset the increment offset.
     */
	public int increment(int offset) {
		CharSequence txt = getText();
		int i;
		if (txt != null) {
			try {
				i = Integer.parseInt(txt.toString());
			} catch (NumberFormatException e) {
				i = 0;
			}
		} else {
			i = 0;
		}
		i = i + offset;
		setText(String.valueOf(i));
		return i;
	}
	
	/**
     * Decrement the numeric badge label. If the current badge label cannot be converted to
     * an integer value, its label will be set to "0".
     * 
     * @param offset the decrement offset.
     */
	public int decrement(int offset) {
		return increment(-offset);
	}

    private float circleR=0f;
    private float height=0f;
    private float width=0f;

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
	  super.onMeasure(widthMeasureSpec, heightMeasureSpec);
	   height=getMeasuredHeight();
	   width=getMeasuredWidth();
	  circleR=Math.min(height,width);
    }

    private Drawable getDefaultBackground() {

//		int r = dipToPixels(DEFAULT_CORNER_RADIUS_DIP);
//		float[] outerR = new float[] {r, r, r, r, r, r, r, r};
//
//		RoundRectShape rr = new RoundRectShape(outerR, null, null);
//		ShapeDrawable drawable = new ShapeDrawable(rr);
//		drawable.getPaint().setColor(badgeColor);

	    measure(0,0);

	    paint.setColor(badgeColor);
	    Drawable drawable1=new Drawable() {
		  @Override
		  public void draw(Canvas canvas) {
			canvas.drawCircle(width / 2, height / 2, circleR / 2,paint);
		  }

		  @Override
		  public void setAlpha(int alpha) {
			paint.setAlpha(alpha);
		  }

		  @Override
		  public void setColorFilter(ColorFilter colorFilter) {
			paint.setColorFilter(colorFilter);
		  }

		  @Override
		  public int getOpacity() {
			return PixelFormat.TRANSLUCENT;
		  }
	    };



		return drawable1;

	}



    private void applyLayoutParams() {
		
		FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
		
		switch (badgePosition) {
		case POSITION_TOP_LEFT:
			lp.gravity = Gravity.LEFT | Gravity.TOP;
			lp.setMargins(badgeMarginH, badgeMarginV, 0, 0);
			break;
		case POSITION_TOP_RIGHT:
			lp.gravity = Gravity.RIGHT | Gravity.TOP;
			lp.setMargins(0, badgeMarginV, badgeMarginH, 0);
			break;
		case POSITION_BOTTOM_LEFT:
			lp.gravity = Gravity.LEFT | Gravity.BOTTOM;
			lp.setMargins(badgeMarginH, 0, 0, badgeMarginV);
			break;
		case POSITION_BOTTOM_RIGHT:
			lp.gravity = Gravity.RIGHT | Gravity.BOTTOM;
			lp.setMargins(0, 0, badgeMarginH, badgeMarginV);
			break;
		case POSITION_CENTER:
			lp.gravity = Gravity.CENTER;
			lp.setMargins(0, 0, 0, 0);
			break;
		default:
			break;
		}
		
		setLayoutParams(lp);
		
	}



	/**
     * Returns the target View this badge has been attached to.
     * 
     */
	public View getTarget() {
		return target;
	}

	/**
     * Is this badge currently visible in the UI?
     * 
     */
	@Override
	public boolean isShown() {
		return isShown;
	}

	/**
     * Returns the positioning of this badge.
     * 
     * one of POSITION_TOP_LEFT, POSITION_TOP_RIGHT, POSITION_BOTTOM_LEFT, POSITION_BOTTOM_RIGHT, POSTION_CENTER.
     * 
     */
	public int getBadgePosition() {
		return badgePosition;
	}

	/**
     * Set the positioning of this badge.
     * 
     * @param layoutPosition one of POSITION_TOP_LEFT, POSITION_TOP_RIGHT, POSITION_BOTTOM_LEFT, POSITION_BOTTOM_RIGHT, POSTION_CENTER.
     * 
     */
	public void setBadgePosition(int layoutPosition) {
		this.badgePosition = layoutPosition;
	}

	/**
     * Returns the horizontal margin from the target View that is applied to this badge.
     * 
     */
	public int getHorizontalBadgeMargin() {
		return badgeMarginH;
	}
	
	/**
     * Returns the vertical margin from the target View that is applied to this badge.
     * 
     */
	public int getVerticalBadgeMargin() {
		return badgeMarginV;
	}

	/**
     * Set the horizontal/vertical margin from the target View that is applied to this badge.
     * 
     * @param badgeMargin the margin in pixels.
     */
	public void setBadgeMargin(int badgeMargin) {
		this.badgeMarginH = badgeMargin;
		this.badgeMarginV = badgeMargin;
	}
	
	/**
     * Set the horizontal/vertical margin from the target View that is applied to this badge.
     * 
     * @param horizontal margin in pixels.
     * @param vertical margin in pixels.
     */
	public void setBadgeMargin(int horizontal, int vertical) {
		this.badgeMarginH = horizontal;
		this.badgeMarginV = vertical;
	}
	
	/**
     * Returns the color value of the badge background.
     * 
     */
	public int getBadgeBackgroundColor() {
		return badgeColor;
	}

	/**
     * Set the color value of the badge background.
     * 
     * @param badgeColor the badge background color.
     */
	public void setBadgeBackgroundColor(int badgeColor) {
		this.badgeColor = badgeColor;
		badgeBg = getDefaultBackground();
	}
	
	private int dipToPixels(int dip) {
		Resources r = getResources();
		float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dip, r.getDisplayMetrics());
		return (int) px;
	}

}


Android最新消息数目提醒控件BadgeView的使用 最近项目中需要用到这样的一个功能 就是消息数量的提示,本想着自己去在布局中自定义一个控件 把它写死  给它一个num(消息数量的属性 )可以进行设置消息数量,但是考虑后后期的样式  以及在不同View上显示  就果断放弃了  偶尔一次机会  看到一位大神在放微信app的时候用到了一个控件  是的  就是BadgeView  这是github上一个开源的控件 专门用来做消息数目提示的  这个是它的g 阅读详情

相关推荐

Android代码-漂亮的角标View

LabelView Sometimes, we need to show a label above an ImageView or any other views. Well, LabelXXView will be able to help you. It's easy to implement as well! Import your project Gradle Step 1. Add the JitPack repository to your build file Add it in your root build.gradle at the end of repositories: allprojects { repositories { ... maven { url "https://jitpack.io" } } } Step 2. Add the dependency dependencies { compile 'com.github.linger1216:labelview:v1.1.2' }

BadgeView简单使用

效果就是在一个View上有一个小红圈,表示未读数。 效果图如下:使用的是Github上面的一个开源的自定义控件。 Github地址:https://github.com/stefanjauker/BadgeView示例代码:BadgeView badgeView = new BadgeView(this); badgeView.setTargetView(findViewById(R.id.bt

一个码农的自我修养 1万+

BadgeView自定义数字提醒控件

本控件是一个给view添加红色数字标签的小例子源码,这个开源项目提供了一种简便的方式,能够在运行期对任意给定的Android view添加徽章, 而不必配合它的布局。可添加的标签包括但不限于右上角的红色数字提醒角标。详细的使用方法可以参考这里

BadgeView实现源码分析

BadgeView实现:public class BadgeView extends TextView-->本质是TextView   (BadgetView:徽章,奖章) 使用 View target = findViewById(R.id.target_view); BadgeView badge = new BadgeView(this, target); badge.setText

lin111000713的专栏 498

android_BadgeView

可实现类似短信未读短信数目提醒的效果,从网上下载来的,分享给大家。。

fibplus-8.0.0.zip

FIBPlus 是一套面向 Delphi / C++Builder 的 Firebird、InterBase 数据库访问组件,特点是直接走原生客户端 API,不经 BDE/ODBC,速度快且可控性强。8.0.0 版本主要适配 Delphi 2009 及以后的版本(Delphi 6–2007 需用 7.9.x),核心组件包括 TpFIBDatabase、TpFIBTransaction、TpFIBDataSet 等,支持精细事务管理、本地缓存、BLOB 处理和备份恢复等数据库服务。该库原为 Devrace 的商业组件,现由社区在 GitHub 的 madorin/fibplus 项目开源维护,建议从官方仓库获取源码而非第三方网盘压缩包。安装时解压后用对应版本的工程组(10.4+ 统一为 `FIB.groupproj`)Build 全部包,再 Install `dclFIB` 并在 Library 路径加入 Source 目录即可。新项目中若需官方技术支持,也可考虑 FireDAC、IBDAC 等更现代的替代方案。

安卓 购物车上的小红点的2种方法1,传统布法,2,BadgeView

购物车上的购买数量的小红点,难倒了2个同事,还是kankan来解决。 2种方法,传统布局法,与badgeview 首先看布局,伊特includelayout 中加载一个顶部菜单栏

kan1kan5的专栏 5134

HyperMesh实战:用Field工具搞定复杂载荷映射(附TCL脚本示例)

本文深入探讨了HyperMesh中Field工具在复杂载荷映射中的高级应用,包括从CSV到有限元网格的温度场映射全流程、稀疏数据处理技巧及TCL自动化脚本示例。通过Field工具,工程师可以高效实现CFD温度场到结构网格的精准映射,显著提升有限元分析的精度与效率。

white的博客 265

用badgeview实现tab的角标

首先看一下程序在手机上运行的效果:用ViewPager + Fragment实现了Tab界面,用第三方的框架badgeView来实现Tab上的角标FirstFragment的布局文件tab01.xml的代码<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/a

Chenqiang920502的博客 1912

PADS Logic VX2.5元件绘制全流程:从零开始创建自定义元件库

本文详细介绍了在PADS Logic VX2.5中从零开始创建自定义元件库的全流程。内容包括理解PADS独特的四库分立结构、绘制原理图符号(CAE封装)、关联PCB封装、创建元件类型以及最终的调用验证。掌握元件绘制技能能从根本上提升设计效率、确保设计规范统一,并从源头杜绝原理图与PCB之间的关联错误,是硬件工程师必备的核心能力。

oo7890的博客 441

数字IC后端时钟树综合实战:OCC电路优化与时钟树平衡策略

本文深入探讨了数字IC后端设计中时钟树综合的关键挑战,重点分析了OCC电路时钟树优化的必要性。通过实战案例,详细阐述了如何通过手动干预、时钟分组与分段长树等策略,避免工具自动平衡导致的时序违例和资源浪费,从而有效实现时钟树平衡并提升设计质量。

weixin_29306261的博客 326

android 自定义权限

android自定义权限的时候,无论是在哪个程序里定义的该权限,其它程序就不用在重复定义,可以直接申明。 比如A程序定义权限: B程序里就可以直接申明这个权限: 安全机制也在于权限。比如我自己写的数据库,我定义一个访问权限,其它程序要访问这个数据库,必须申明该权

187

基于YOLO11的垃圾分类AI模型训练实战

通过这次实战,我们成功训练出了一个高性能的垃圾分类AI模型。项目展示了从数据准备、模型训练到结果分析的完整流程,为AI在环保领域的应用提供了有价值的参考。项目文件结构│ ├── best.pt # 最佳模型权重│ └── last.pt # 最新模型权重├── results.csv # 详细训练数据├── results.png # 训练曲线图├── confusion_matrix.png # 混淆矩阵└── args.yaml # 训练参数配置。

lydz1的博客 1657

Android BadgeView使用介绍 (数字提醒提示)

前段时间做的一个淘宝客的项目,需要在商品图片上添加价格标签,之前自己使用TextView和Cavas绘制的感觉效果一般,今天偶然在优快云上发现BadgeView这个开源项目,在git下载下来之后,使用非常方便,简单介绍下它的使用,感谢作者Jeff Gilfelt。 BadgeView主要是继承了TextView,所以实际上就是一个TextView,底层放了一个label,可以自定义背景图,自定

Dream It Possible 1万+

从零到一:基于Docker与OSM数据构建Valhalla路径规划服务及Mapbox风格可视化

本文详细介绍了如何从零开始,基于Docker容器技术快速部署开源的Valhalla路径规划服务。通过获取免费的OSM地图数据并构建路网,最终实现服务调用与Mapbox风格的地图可视化,为出行应用原型开发或本地化路径规划服务提供了一套完整、高效的实践方案。

weixin_29297127的博客 161

Audio2Face进阶玩法:结合LiveLink在UE5中实现MetaHuman全身动画+语音驱动(保姆级配置指南)

本文提供了一份详尽的保姆级教程,指导如何将NVIDIA Audio2Face与Unreal Engine 5的LiveLink功能结合,实现驱动MetaHuman数字人面部表情的同时,无缝融合身体动画。文章详细讲解了从环境准备、插件部署、基础面部驱动测试,到动画蓝图高级配置与多数据流融合的全流程,并分享了性能优化与问题排查的实战经验,旨在帮助创作者打造表情与肢体动作协调统一的生动数字人。

q9w8e7r6t5的博客 196

GitHub控件之BadgeView(数字提醒)

数字提醒大家肯定都见识过。QQ、微信等app中如果有消息或者提醒的时候,就会展现给用户一个红点或者带有数字的点。前段时间微信上流行把自己的头像换成带有数字提醒的头像,让那些有强迫症的人真是抓狂。     下面我们就看一下怎么在自己的app中实现这种效果。     开发者当然可以自己用相对布局来实现这样的效果。一个还好,但是多了呢!就会很繁琐。GitHub上有一个开源的第三方控件,叫做B

crazy_jack 6万+

手把手教你学Simulink——四开关 Buck‑Boost(FSBB)变换器的无缝模式切换仿真

本文详细介绍了四开关Buck-Boost(FSBB)变换器的Simulink仿真方法,重点解决模式切换时的直通风险和输出电压波动问题。通过统一电压PI控制、迟滞比较模式仲裁(Buck/Boost/Pass-Through)和200ns死区设计,实现了Vin从26V到22V变化时Vout稳定在12V±0.15V。关键步骤包括:搭建功率级电路、Stateflow模式判断、PI控制器输出占空比映射(Buck模式D≈Vo/Vin,Boost模式D≈1-Vo/Vin),以及带死区的PWM信号分配。仿真验证了切换过程中

MHD0815的博客 115

BadgeView使用介绍

前段时间做的一个淘宝客的项目,需要在商品图片上添加价格标签,之前自己使用TextView和Cavas绘制的感觉效果一般,今天偶然在优快云上发现BadgeView这个开源项目,在git下载下来之后,使用非常方便,简单介绍下它的使用,感谢作者Jeff Gilfelt。 BadgeView主要是继承了TextView,所以实际上就是一个TextView,底层放了一个label,可以自定义背景图,自定

码农执笔 6435

Altium Designer(AD24/25)导出DXF或DWG结构文件的方法

DXF(Drawing Exchange Format)和DWG(Drawing)是两种常见的CAD(计算机辅助设计)文件格式,常用于结构和硬件之间的沟通。本文介绍Altium Designer(AD24/25)导出DXF或DWG结构文件的方法。

fydar的博客 2319

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

开源框架BadgeView的使用简介

github地址https://github.com/qstumn/BadgeViewpublic class MainActivity extends AppCompatActivity { TextView tv1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCr...

果酱大师的博客 910

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

android布局上上加红点数字,GitHub - liyanxi/BadgeView: view 上添加小红点(含数字)

BadgeViewadd badgeview to any targetView in AndroidUsageStep1Add dependencies in build.gradle.dependencies {compile 'com.itingchunyu.badgeview:badgeview:1.0.5'}注释:v1.0.5版本引用名称作如下修改IBadgeTextView===&gt...

weixin_33842969的博客 294

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

BadgeView 给控件设置未读消息红点

最近做设置未读消息红点时,感觉TextView显示一个shape背景 时候,文字信息不在圆的正中心,所以自己写了一个可控的BadgeView。之所以说可控是因为代码是自己写的,以后需要什么样的就直接自定义。 if (numberStr != null){ int radius = getWidth() / 2; canvas.drawCircle(radius,radius,...

HopCoder 670

安卓数字消息提醒、角标-测试BadgeView效果

效果 代码 1.BadgeViewTwo.java package com.fe.statuslayout; import android.app.Activity; import android.graphics.Color; import android.graphics.Typeface; import android.os.Bundle; import android.

dianziagen的博客 2255
上一篇: String的个人记录
下一篇: java 值传递的个人理解
千雅爸爸
博客等级 码龄18年 292粉丝 639原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值