将EditText限制为2个字符

时间:2015-05-29 21:35:18

标签: android view android-edittext

我正在为Android开发应用程序,我想将EditText限制为仅2个字符。你对此有所了解吗?

2 个答案:

答案 0 :(得分:2)

android:maxLength="2"添加到xml。

答案 1 :(得分:1)

在EditText XML中添加此

  final SimplePath<ListSubQuery> latestSubQueryPath = Expressions.path(ListSubQuery.class, "latest");
  final SimplePath<Timestamp> caseLatestMentioned = Expressions.path(Timestamp.class, "caseLatestMentioned");
  final SimplePath<Integer> latestCaseId = Expressions.path(Integer.class, "latest.caseId");

  final ListSubQuery<Tuple> latest = new SQLSubQuery()
          .from(ucm2)
          .innerJoin(pcm2).on(ucm2.id.eq(pcm2.id))
          .groupBy(pcm2.caseId)
          .list(pcm2.caseId.as(latestCaseId), ucm2.lastExtracted.max().as(caseLatestMentioned));

  q.from(ucm)
          .join(pcm).on(ucm.id.eq(pcm.id))
          .innerJoin(latest, latestSubQueryPath).on(pcm.caseId.eq(latestCaseId))
          .where(ucm.lastExtracted.eq(caseLatestMentioned));
相关问题