- 博客(9)
- 收藏
- 关注
原创 RecyclerView 添加头部和尾部布局
RecyclerView 不能添加 headerView 和 footView,这就有点蛋疼了,也许你会说,没事啊,我们可以重写getItemViewType(int position)这个方法,让他实现多个布局,具体实现如下: @Override public int getItemViewType(int position) { if (position == 0)
2016-05-23 22:17:04 1756
原创 Android在布局中动态添加view的两种方法
一、说明 添加视图文件的时候有两种方式:1、通过在xml文件定义layout;2、java代码编写二、前言说明1.构造xml文件2.LayoutInflater提到addview,首先要了解一下LayoutInflater类。这个类最主要的功能就是实现将xml表述的layout转化为View的功能。为了便于理解,我们可以将它与findViewById()作一比较,二者都是实例化某一对象,不同的是f
2016-05-19 17:30:42 42481 1
原创 ListView和GridView,ViewPager滑动到顶部和底部时出现的阴影消除方法
ListView和GridView滑动到顶部和底部时出现的阴影消除方法: android2.3以前用android:fadingEdge=”none” android2.3以后用setOverScrollMode(View.OVER_SCROLL_NEVER)
2016-05-06 17:41:05 857
原创 Leetcode题解14 84. Largest Rectangle in Histogram(hard)
Given n non-negative integers representing the histogram’s bar height where the width of each bar is 1, find the area of largest rectangle in the histogram. Above is a histogram where width of each ba
2016-05-06 11:11:29 673
原创 ListView的setSelection()方法
1.当setSelection()中的参数小于0,ListView将会选择第0项。 2.当setSelection()中的参数大于数据长度-1时,ListView将会往上滑到最后。 3.其他情况,若ListView还可以往上滑,则选择参数作为显示的第一个条目。 4.否则,ListView将会往上滑到最后。 也就是说,当最后一个条目显示出来时,对于ListView的setSelection()
2016-05-04 17:29:16 5092
原创 Leetcode题解14 345. Reverse Vowels of a String
Write a function that takes a string as input and reverse only the vowels of a string.Example 1: Given s = “hello”, return “holle”.Example 2: Given s = “leetcode”, return “leotcede”.public class Solu
2016-05-03 18:24:17 536
原创 Leetcode题解14 20. Valid Parentheses
Given a string containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[’ and ‘]’, determine if the input string is valid.The brackets must close in the correct order, “()” and “()[]{}” are all valid but “
2016-05-03 18:11:33 247
原创 Leetcode题解14 237. Delete Node in a Linked List
Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given the third node with value 3, t
2016-05-03 17:48:45 305
原创 Leetcode题解14 344. Reverse String
Write a function that takes a string as input and returns the string reversed.Example: Given s = “hello”, return “olleh”.public class Solution { public String reverseString(String s) { Str
2016-05-03 17:37:28 822
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人