- 博客(11)
- 资源 (17)
- 收藏
- 关注
原创 适配ListView和RecyclerView构建多Item模板的终极杀器——MTSimpleAdapter
本文中的DEMO和library已上传到github: https://github.com/devilthrone/MTSimpleAdapter 欢迎fork and star O(∩_∩)O需求背景我们在Android开发中经常会遇到下列场景:一个ListView中需要展示多种不同的布局。例如:聊天界面、消息盒子等场景。通常的实现方式是: 重写getViewTypeCount方法返回布局的
2016-04-16 20:49:07 1810 4
原创 Groovy入门(四)——集合Map
Mapmap声明方式def myMap =['a':1,'b':2,'c':3]assert myMap instance HashMapassert myMap.size() == 3assert myMap['a'] == 1def emptyMap = [:]assert emptyMap.size() ==0def map = new TreeMap()map.putAll(my
2016-04-18 21:13:40 9356 1
原创 Groovy入门(三)——集合类型List
Listgroovy中的List结合了Java中数组和List的优势,既可以用下标的形式来访问数组中的元素,而且可以动态扩展数组,相当方便!声明ListList有以下三种声明方式myList =[1,2,3]myList = new ArrayList() 或者 mylinkList = new Linklist(myList);longList = (0..100).toList()Lis
2016-04-18 20:41:58 16978
原创 Groovy入门(二)——集合类型-Range
1. 范围 Rangesranges用..表示范围操作符,用来指定左边界和右边界 ep: (0..10) -> 01234567890..<操作符指定了半排除范围,不包含右边界 ep:(0..<10) -> 0123456789range也可以通过显示方法创建:def a = new IntRange(0,10)Range主要方法range主要有如下方法:1.contains:是否包含
2016-04-18 20:41:03 2528
原创 leetcode 205: Isomorphic Strings
题目描述:Given two strings s and t, determine if they are isomorphic.Two strings are isomorphic if the characters in s can be replaced to get t.All occurrences of a character must be replaced with another
2016-04-17 19:10:13 467
原创 leetcode 290:Word Pattern
题目描述:Given a pattern and a string str, find if str follows the same pattern.Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty word in str.Exampl
2016-04-17 16:50:24 429
原创 leetcode 19:Remove Nth Node From End of List
题目描述 Given a linked list, remove the nth node from the end of list and return its head. For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from
2016-04-16 15:59:20 354
原创 leetcode 235:Lowest Common Ancestor of a Binary Search Tree
题目描述:Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined betwee
2016-04-15 17:44:59 355
原创 leetcode 101:Symmetric Tree
题目描述:Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \2 2/ \ / \3 4 4 3But the following is not:
2016-04-15 17:33:14 426
原创 求数组最大子序列的和
题目:给出数组{4,-3,5,-2,-1,2,6,-2},求子序列的最大和。分别用一下两种方法解决。#include <stdio.h>// 方法1: 分治法//时间复杂度 O(NlogN)int max3(int num1 , int num2 , int num3){ int max = num1; if(max<num2)max= num2; if(max<nu
2016-04-03 18:55:21 2900 1
原创 求最大公约数的两种算法
1.辗转相除法辗转相除法是求两个自然数的最大公约数的一种方法,也叫欧几里德算法。 例如,求gcd(319,377): ∵ 377÷319=1(余58) ∴gcd(377,319)=gcd(319,58); ∵ 319÷58=5(余29), ∴ gcd(319,58)=gcd(58,29); ∵ 58÷29=2(余0), ∴ gcd(58,29)= 29; ∴ gcd(319,377)
2016-04-03 18:03:09 10758
android 浮动搜索框
2015-05-15
android人脸识别——HowOld测测你的年龄
2015-05-14
Android自定义控件——闪闪发光的流光字体
2015-05-12
Android自定义动画 3D旋转
2015-05-09
Android DialogFragment的使用方法
2015-05-08
Android动画效果 添加购物车抛物线
2015-04-20
Android自定义控件——圆形进度条
2015-04-18
Android自定义控件之音量控制器
2015-04-13
Android自定义控件——音量控制器
2015-04-13
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人