自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

lidongxiu0714

读书以博学,实践以登高!!!

  • 博客(12)
  • 收藏
  • 关注

原创 自定义View的四个构造函数

自定义View继承View或者ViewGroup都会让我们实现构造函数,通常会实现一个参数的构造函数,两个参数的构造函数和三个参数的构造函数,它们有什么区别,又为什么要实现这么多构造函数呢?public class DemoView77 extends View { public DemoView77(Context context) { super(context);...

2019-03-29 13:51:16 5038 1

原创 Android自定义View 之自定义属性

1 自定义属性值自定义view的起步是自定义属性,并且正确的读取属性。在res/values/attrs.xml的文件中创建属性: <declare-styleable name="ViewDemoAttr35"> <attr name="string35" format="string"/> <attr name="bool...

2019-03-28 16:53:15 5934

原创 getHeight,getWidth,getMeasuredHeight,getMeasureWidth

源码分析 /** * Like {@link #getMeasuredHeightAndState()}, but only returns the * raw height component (that is the result is masked by * {@link #MEASURED_SIZE_MASK}). * * @ret...

2019-03-28 13:56:52 2555

原创 View的invalidate和postInvalidate

1 作用invalidate和postInvalidate常用于刷新View,都会导致View重绘,重新调用view的onDraw方法。invalidate必须在ui线程使用,postInvalidate可以在子线程中使用。 /** * Invalidate the whole view. If the view is visible, * {@link #onDr...

2019-03-27 16:40:26 986

原创 EditText设置只能输入某些字符TransformationMethod,自动把输入小写字母转成大写

1 TextView的 android:textAllCaps=“true”TextView上可以设置 android:textAllCaps="true"就可以把text中的小写字母展示成大写字母,如果想让EditText也可以把输入的小写字母转换成大写字母呢。注意:如果在EditText中添加android:textAllCaps=“true”,当在EditText中输入时会导致崩溃:...

2019-03-14 15:11:47 5023

原创 RecyclerView 滑动时不加载图片,空闲时恢复图片加载

mRecycleView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrollStateChanged(RecyclerView recyclerView, int newState) { if...

2019-03-14 10:09:19 6427 2

原创 简单的底部弹出窗,BottomSheetDialog

1 BottomSheetDialog 底部弹出框BottomSheetDialog的简单使用: /** * func:弹出举报dialog */ private void showShieldDialog(long articleId,int articleType) { if (getActivity() == null) return;...

2019-03-08 15:46:38 2993

原创 一次软键盘引起的界面跳动

软键盘导致界面被顶起在RelativeLayout布局中放置在顶部的View由于受到软键盘弹起的影响,会被顶到软键盘以上,体验非常不好,这时可以给Activity设置 android:windowSoftInputMode=“adjustPan|stateHidden”,就可以防止底部View被顶起。上面的问题应该是比较普遍的问题,解决方法网上说的也很多。但更多的时候我们遇到的是软键盘遮挡的问题...

2019-03-08 15:21:32 1827

原创 利用CoordinatorLayout+AppBarLayout+TabLayout+ViewPager+RecycleView实现最简单的个人主页

首先看效果图,这几乎是最简单的实现可滑动头部,RecycleView 滑动到顶部时,头部View出来。代码实现XML布局文件:&amp;lt;android.support.design.widget.CoordinatorLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot; xmlns:app=&quot;htt...

2019-03-08 10:41:28 13512 8

原创 CountDownTimer 一步实现最简单的倒计时控件

1 CountDownTimerCountDownTimer是Google提供的一个倒计时工具类,利用这个工具可以很方便的实现倒计时功能。Schedule a countdown until a time in the future, with regular notifications on intervals along the way.构造函数:CountDownTimer(lon...

2019-03-07 19:59:13 4446 1

原创 TextView富文本学习二(获取html代码片段中的超链接地址,设置点击事件,并设置连接样式)

1 利用SpannableStringBuilder获取存在的Span/*** Return an array of the spans of the specified type that overlap* the specified range of the buffer. The kind may be Object.class to get* a list of all the...

2019-03-04 15:02:59 2923

原创 Android富文本的学习一

1TextView的富文本介绍:什么是富文本,大家都知道TextView可以显示文字,设置文字样式,利用富文本可以给TextView添加更多的样式,更加的类似h5网页,例如在一个TextView通常显示的文本样式是统一的,如果想对显示的同一段文本不同部分的文字设置不同的样式,颜色,大小等就需要用到富文本,富文本还可以利用TextView显示图片,设置点击事件等。TextView想要实现富文本...

2019-03-03 16:43:07 3032

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除