public float getFraction(@FractionRes int id, int base, int pbase)
源码中方法解释如下:
Retrieve a fractional unit for a particular resource ID.
Params:
id – The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier. base – The base value of this fraction. In other words, a standard fraction is multiplied by this value. pbase – The parent base value of this fraction. In other words, a parent fraction (nn%p) is multiplied by this value.
Returns:
Attribute fractional value multiplied by the appropriate base value.
Throws:
Resources.NotFoundException – Throws NotFoundException if the given ID does not exist.