- 博客(12)
- 资源 (1)
- 收藏
- 关注
原创 View.isInEditMode()方法的作用
/** * Android源码 * Indicates whether this View is currently in edit mode. A View is usually * in edit mode when displayed within a developer tool. For instance, if * this View ...
2020-03-27 14:23:48 4776 1
原创 TextureView.setTransform(Matrix transform)方法的作用
今天在学习Github上大佬的代码的时候,发现了一个方法Texture.setTransform() /** * <p>Sets the transform to associate with this texture view. * The specified transform applies to the underlying surface ...
2020-03-26 13:55:01 3668
原创 Dialog的弹出位置控制
Dialog一般出现都是屏幕中心,但有的时候我们希望它能在屏幕左侧,或者右侧亦或者是屏幕顶部。这时候我们就需要用的Dialog.getWindow().getAttributes()方法啦dialog = new Dialog(getActivityContext());dialog.setContentView(localView); //下面的几个属性可能也会经常用...
2020-03-25 19:08:51 9725
原创 Android View.getLocationOnScreen的作用
Android View.getLocationOnScreen记录一下getLocationOnScreen方法的作用/** * <p>Computes the coordinates of this view on the screen. The argument * must be an array of two integers. After ...
2020-03-25 15:22:48 2933
原创 Android环境下OpenGL ES的学习(二)
接上回书(OpenGL ES的学习)说道。。。继续讲讲OpenGLES中的矩阵操作Matrix.rotateM方法用于旋转摄像头矩阵,它需要传入6个参数 /** * Android中的源码 * Rotates matrix m in place by angle a (in degrees) * around the axis (x, y, z)....
2020-03-21 10:29:25 190
原创 Android环境下OpenGL ES的学习
写在前面:我也是OpenGL的初学者,本篇是作为一个学习笔记来写的。首先学习一下关于OpenGL中的重要概念:矩阵你做了一个物体想放在空间某一个坐标上,需要一个World矩阵吧?然后你需要一个摄像机来拍摄这个物体,让这个物体可见,对吧?那不就需要:1、View矩阵,决定摄像机在哪里,朝哪里看。2、Projection矩阵,摄像机的视角、焦距、近平面、远平面。3、最后把物体的每个...
2020-03-20 09:42:32 212
原创 算法学习---贪心算法
想通过这篇博客来分享一下学习贪心算法和动态规划的过程首先什么是贪心算法?百度百科给出的释义是:贪心算法(又称贪婪算法)是指,在对问题求解时,总是做出在当前看来是最好的选择。也就是说,不从整体最优上加以考虑,他所做出的是在某种意义上的局部最优解。翻译成人话就是用简单粗暴的方式,以最少的代价(占用的时间和空间),得出结果。比如某面包店有A、B、C三种大小的面包,其中A面包可以提供10点...
2020-03-19 15:03:58 201
原创 Java基本功之i++、i--、++i、--i
今天敲代码的时候被基础给击倒了(难受 while (i < j) { res = height[j] > height[i] ? Math.max(res, height[i++] * (j - i)): Math.max(res, height[j++] * (j ...
2020-03-19 10:35:48 853
原创 Android Handler知识学习记录(一)Handler的postDelayed和postAtTime
//Handler中的源码 public final boolean postDelayed(Runnable r, long delayMillis) { return sendMessageDelayed(getPostMessage(r), delayMillis); } public final boolean sendMessa...
2020-03-18 15:04:59 2522
原创 LeetCode解题记录之队列最大值
题目:请定义一个队列并实现函数 max_value 得到队列里的最大值,要求函数max_value、push_back 和 pop_front 的均摊时间复杂度都是O(1)。若队列为空,pop_front 和 max_value需要返回 -1public class MaxQueue{ public MaxQueue(){ } publ...
2020-03-08 15:14:05 305
原创 Android中的System.currentTimeMillis和SystemClock类
最近在看Handler源码的时候发现了Android系统中对于获取时间的不同方法。首先是我们比较常用的System.currentTimeMillis,它计算的是从1970年1月1日开始的时间,以毫秒为单位。使用这个方法的存在一定的风险,因为它是以系统时间为基准的,而我们可以通过SystemClock.setCurrentTimeMilis来设置系统时间。比如说我们设置了一个定时任务在...
2020-03-06 10:52:41 3045 1
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人