maoruibin / maoruibin/maoruibin.github.com

TextView maxWidth maxLength maxEms 区别

Open
#67 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
22
Forks
4
PR merge metrics
No merged PRs in 30d

Description

from https://blog.csdn.net/pashanhuxp/article/details/51167954
thanks http://blog.csdn.net/JavaLive09/article/details/38661773

  • maxWidth=”80dp” 限制TextView最大宽度。必须与layout_width=”wrap_content”搭配使用,当指定layout_width为其他值时,maxWidth会失效。

  • maxLength=”10” 限制TextView最多10个字符数。汉字、英文、数字都算一个字符。maxLength属性会使ellipsize=”end”属性失效。添加了maxLength不再会显示”…”

  • maxEms=”5” 限制TextView的最大宽度为5个大写M的字符宽度。em是一个印刷排版的单位,表示字宽的单位。 em字面意思为:equal M(和M字符一致的宽度为一个单位)简称em。ems是em的复数表达。

  • maxEms与maxWidth很相似,只是单位不一样,都是限制TextView的最大宽度,所以可以和ellipsize属性共用。

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the two linked source articles and inspect the repository's existing blog or documentation structure before deciding where this comparison belongs. The issue does not name a target file or requested change, so confirm the intended update and define completion as a published, repository-consistent explanation of the three TextView attributes.

Written by the indexing model from the issue text.

Assessment

Tech stack
android
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.