William的小星球 
  • 首页
  • 归档
  • 分类
  • 标签
  • 关于
  •     

View#scrollBy(int-x-,-int-y)反向

先看下源码 public void scrollBy(int x, int y) { scrollTo(mScrollX + x, mScrollY + y); } public void scrollTo(int x, int y) { if (mScrollX != x || mScrollY != y) { int oldX = mScrollX; int oldY = mScrollY; mScrollX = x; mScrollY = y; invalidateParentCaches()
 2018-07-27   View   

android模拟简单跨进程通信

android模拟简单跨进程通信 需求:当前进程需要和远程进程通信,调用远程Service的getEntity(int age)方法,客户端(当前进程)传入参数int age,服务端(远程Service进程)根据得到的参数返回Entity。 1. 建立客户端和服务端通信的共同协议:接口让Entitiy类实现Parcelable接口: //省略get set方法。 public class Entity implements Parcelable{ private int age; private String name; private String country;
 2018-07-26   Android   

Hugo配合GitHub搭建博客(Windows-10)

Hugo配合GitHub搭建博客(Windows 10) 前提: 会Git和GitHub 安装git 安装hugo 安装hugo 安装Chocolatey 以管理员身份运行cmd命令行 直接输入以下命令,回车。 @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).Downlo
 2018-07-23   搭建博客相关   

git修改commit信息。

在Android Studio上面直接操作Version Control的reword是最直接的。 用git的方式来: git rebase -i HEAD~1打开了文本编辑器 pick 10130de msg # Rebase da71f75..10130de onto da71f75 (1 command) # # Commands: # p, pick <commit> = use commit # r, reword <commit> = use commit, but edit the commit message # e, edit <commit&
 2018-07-20   git   

启动一个Activity

Activity启动startActivity()|| || V startActivityForResult() || || V ActivityStackSupervisor # realStartActivityLocked(){ //... app.thread.scheduleLaunchActivity(new Intent(r.intent), r.appToken, System.identityHashCode(r), r.info, new Configuration(mService.mConfigur
 2018-07-20   View   

View#post(Runnable-runnable)为什么能拿到view的宽高。

结论:view.post()方法在整个view树的performMeasure, performLayout, performDraw执行完后,才被主线程轮询到,才得到执行。 基于android sdk-23的源码分析,文章分成两个部分,实际上我是先写第二部分了再写第一部分的。 第一部分看一下view.post的内部。 public boolean post(Runnable action) { final AttachInfo attachInfo = mAttachInfo; if (attachInfo != null) { return attachI
 2018-07-19   View   

RecyclerView记事

当RecyclerView组装完后,立刻去获取Item的高度:int childHeight = recyclerView.getLayoutManager().findViewByPosition(0).getHeight();会报空指针,因为itemView还没有attach到recyclerView中,获取不到itemView,用view.post()解决recyclerView.post(new Runnable){ int childHeight = recyclerView.getLayoutManager().findViewByPosition(0).getHeight()
 2018-07-19   Android   

git压缩版本快照

目前有两种方案: git merge --squash git rebase -i HEAD~n 1. mergegit merge --squash <要合并的分支>例子:本地的情况: 用普通的git merge 当用git checkout master+git merge develop:此时用git push,会将3,4,5,10,11,12,13的版本快照全部push到服务器去。那么如果要我要压缩,把这么多版本快照压缩成一个版本快照然后push到服务器呢?2. 用git merge –squash <要合并的分支> git checkout maste
 2018-07-19   git   

为git设置文本编辑器。

直接输入git commit的时候,或者git rebase -i来压缩的时候,都会进入git默认的文本编辑器,根本不会用,然后只能被迫关闭。后得知可以更改文本编辑器,配置如下: git config --global core.editor "\"D:\应用程序\Sublime Text3\sublime_text.exe\""更改后,当git要进入文本编辑器的时候,就会直接打开路径下的sublime text了。 配制后的C:\Users\admin\.gitconfig如下: //...略 [core] editor = \"D:
 2018-07-19   git   

记录自定义Dialog的一个天坑和启动Dialog的小流程

记录自定义Dialog的一个天坑。/** * Created by 黄伟杰 on 2018/7/17. */ public class MyDialog extends Dialog { private Context context; public MyDialog(@NonNull Context context) { super(context); this.context=context; } @Override protected void onCreate(Bundle savedInstanceSta
 2018-07-17   View   
1…678910…21

搜索

Hexo Fluid