Hello World

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment

分享到

Android Scroller入门(一)之ScrollTo、ScrollBy(转)

###0.前言
在Android开发时,如果需要处理滑动事件,通常会使用到getScrollX()getScrollY()方法。如果需要自定义滑动操作,会使用到scrollTo(...)scrollBy(...)。下面记录它们之间的使用区别。

  • mScrollX:View的内容(content)相对于View本身在水平方向的偏移量。
  • mScrollY::View的内容(content)相对于View本身在垂直方向的偏移量。
  • scrollTo(int x, int y):将一个视图的内容移动到指定位置.此时偏移量 mScrollX,mScrollY就分别等于x,y.
  • scrollBy(int x, int y): 在现有的基础上继续移动视图的内容.

对于ViewGroup来说:

移动的是它对应的所有子View。

注意:scrollTo()和scrollBy()移动的只是View的内容,但是View的背景是不移动的.

查看更多

分享到

获取View的宽高——Android工作记录

###0.前言
在Android开发中,许多场景都需要获取指定View的宽高来进行业务操作。但,有些时候在View的宽高不为0的情况下,通过View.getHeight()或者View.getMeasuredHeight()获取到的数值为0。这是为什么呢?

其实,这种情况和Android的界面绘制流程有关,简单来说,就是View的宽高需要在测量(Measure)之后才确定。

查看更多

分享到