Android学习笔记一:

#Alt+Insert  然后Override Methods快速添加Override方法,或直接Ctrl+O;

elapsedRealtime() and elapsedRealtimeNanos() return the time since the system was booted, and include deep sleep. This clock is guaranteed to be monotonic, and continues to tick even when the CPU is in power saving modes, so is the recommend basis for general purpose interval timing.

Android坐标表示:

Android坐标表示

postInvalidate() 方法

对于线程中的刷新一个 View 为基类的界面,可以使用 postInvalidate() 方法在线程中来处理,其中还提供了一些重写方法比如 postInvalidate(int left,int top,int right,int bottom) 来刷新一个矩形区域,以及延时执行,比如postInvalidateDelayed(long delayMilliseconds) 或 postInvalidateDelayed(long delayMilliseconds,int left,int top,int right,int bottom) 方法,其中第一个参数为毫秒,如下:

void

postInvalidate ()

void

postInvalidate (int left, int top, int right, int bottom)

void

postInvalidateDelayed (long delayMilliseconds)

void

postInvalidateDelayed (long delayMilliseconds, int left, int top, int right, int bottom)

使用shift + tab 可以做向左的缩进, 快去试试!!

1.SystemClock.currentThreadTimeMillis(); // 在当前线程中已运行的时间  
2.SystemClock.elapsedRealtime(); // 从开机到现在的毫秒书(手机睡眠(sleep)的时间也包括在内)  
3.SystemClock.uptimeMillis(); // 从开机到现在的毫秒书(手机睡眠的时间不包括在内)  
4.SystemClock.sleep(100); // 类似Thread.sleep(100);但是该方法会忽略InterruptedException  

5.SystemClock.setCurrentTimeMillis(1000); // 设置时钟的时间,和System.setCurrentTimeMillis类似 

--------------------- 本文来自 liweicai137 的CSDN 博客 ,全文地址请点击:https://blog.csdn.net/liweicai137/article/details/51694207?utm_source=copy 

AttributeSet

A collection of attributes, as found associated with a tag in an XML document. Often you will not want to use this interface directly, instead passing it to Resources.Theme.obtainStyledAttributes() which will take care of parsing the attributes for you. In particular, the Resources API will convert resource references (attribute values such as "@string/my_label" in the original XML) to the desired type for you; if you use AttributeSet directly then you will need to manually check for resource references (with getAttributeResourceValue(int, int)) and do the resource lookup yourself if needed. Direct use of AttributeSet also prevents the application of themes and styles when retrieving attribute values.

This interface provides an efficient mechanism for retrieving data from compiled XML files, which can be retrieved for a particular XmlPullParser through Xml.asAttributeSet(). Normally this will return an implementation of the interface that works on top of a generic XmlPullParser, however it is more useful in conjunction with compiled XML resources:

与XML文档中的标记关联的属性集合。通常,您不希望直接使用此接口,而是将其传递给Resources.Theme.obtainStyledAttributes() 将负责解析属性的接口。特别是,Resources API会将资源引用(原始XML中的“@ string / my_label”等属性值)转换为所需的类型; 如果直接使用AttributeSet,则需要手动检查资源引用(with getAttributeResourceValue(int, int))并在需要时自行执行资源查找。直接使用AttributeSet还会在检索属性值时阻止主题和样式的应用。

此接口提供了一种从编译的XML文件中检索数据的有效机制,可以通过该文件检索特定的XmlPullParser Xml.asAttributeSet()通常,这将返回在通用XmlPullParser之上工作的接口的实现,但是它与编译的XML资源结合使用时更有用:

原文地址:https://www.cnblogs.com/Ravenzzz/p/9733764.html