maoruibin / maoruibin/maoruibin.github.com
View 测量宽高代码
Open
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 22
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Description
private int measureSize(int measureSpec) {
int specMode = MeasureSpec.getMode(measureSpec);
int specSize = MeasureSpec.getSize(measureSpec);
//设置一个默认值,就是这个View的默认宽度为500,这个看我们自定义View的要求
int result = 500;
if (specMode == MeasureSpec.AT_MOST) {//相当于我们设置为wrap_content
Log.i(TAG+"-measure"," wrap_content");
result = Math.min(500, specSize);
} else if (specMode == MeasureSpec.EXACTLY) {//相当于我们设置为match_parent或者为一个具体的值
Log.i(TAG+"-measure"," match_parent or fix size");
result = specSize;
}
return result;
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue contains only a Java measureSize snippet for an Android View and names no file, test, or requested change. Start by identifying whether the intended work is documentation or a code change, then locate the relevant blog entry; done requires a clearly stated outcome and a way to validate it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- documentation, mobile
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100