- 博客(8)
- 收藏
- 关注
原创 Adapter 的 ViewHolder 多种 Type 的时候引发的异常
背景:因为我的 ListView 的 Adapter 要适配两种不同的 ViewHolder,然后在 getItemViewType() 的时候,分别返回 1、2,在 getViewTypeCount() 的时候返回 2,这样就引起了奔溃,而且奔溃的很诡异,就是在进入界面首次展示正常,但是刷新重新填充数据的时候就会奔溃了。错误提示:at android.widget.AbsListView$...
2019-01-25 17:13:08 485
原创 【探索-字节跳动】朋友圈
dfs参考文章:Leetcode学习笔记-547-朋友圈使用深度优先遍历(dfs),如果学生 A 与 B 是好友,则 A 肯定也与 B 的好友圈的任意学生也是好友关系,即有传递性,因此,在遍历到 A 与 B 是好友的时候,还要遍历 B 的好友,与 B 的好友的好友,即会最终把这个圈子的人都遍历到。public int findCircleNum(int[][] M) { if (M...
2019-01-23 23:11:22 1081
原创 【探索-字节跳动】最长连续序列
常规做法,就是先排序,再去处理。public int longestConsecutive(int[] nums) { if (nums == null || nums.length == 0) return 0; Arrays.sort(nums); int max = 1; int tmp = 1; for (int i = 0, len ...
2019-01-21 20:06:09 1858
转载 Kotlin之 apply / with / run / also / let
主要参考:https://www.jianshu.com/p/5c4a954d2b2cwith/** * Calls the specified function [block] with the given [receiver] as its receiver and returns its result. */@kotlin.internal.InlineOnlypublic in...
2019-01-21 16:15:45 116
原创 获取当天、本周、本月开始与结束时的时间戳
1、获取当天开始与结束的时间戳// 当天的 00:00:00fun getStartOfDay(): Long { val calendar = Calendar.getInstance() val year = calendar.get(Calendar.YEAR) val month = calendar.get(Calendar.MONTH) val da...
2019-01-21 15:49:43 2721
原创 实现进入界面默认不显示 EditText 的光标、不调起键盘
在一个界面,有一个或者数个 EditText,如果不做处理,有些机型会默认显示第一个 EditText 的光标,同时弹出键盘,此时,可以给这些 EditText 的公共父布局设置两个属性,就可以解决这个问题。android:focusable="true/false" android:focusableInTouchMode="true"focusable 属性为 true 或者 fals...
2019-01-04 20:25:19 2173
原创 Android 实现像异常日志一样跟踪到具体的日志打印处
即实现下图的效果public class MainActivity extends FragmentActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView...
2019-01-04 17:57:24 400
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人