【问题标题】:Is there any way to generate "Lorem ipsum" in eclipse?有没有办法在 Eclipse 中生成“Lorem ipsum”?
【发布时间】:2014-06-19 00:58:42
【问题描述】:

在为虚拟文本创建视图时,我正在寻找一种在 Eclipse 中生成 Lorem ipsum 的方法。例如,在 Visual Studio 中,您只需键入 lorem 并按 Tab 即可。
在 Eclipse 中有什么可以做到的吗?有什么想法吗?

【问题讨论】:

    标签: eclipse android-layout


    【解决方案1】:

    在 Android Studio 中,您可以使用以下命令预览 lorem ipsum TextViews:

    tools:text="@tools:sample/lorem/random"
    

    您还可以将其用于姓名、城市、邮政编码、头像等。

    https://developer.android.com/studio/write/tool-attributes.html#toolssample_resources

    【讨论】:

    • 对于 TextView,tools:src 对我不起作用,tools:text 可以。
    【解决方案2】:

    我还没有遇到 Eclipse 功能来实际生成虚拟文本,但是我强烈推荐这种解决方法(说实话,我认为你不需要每次都有不同的虚拟文本)。

    创建一个 Eclip 模板。这是一个xml 文件,如下所示:

    <templates>
        <template autoinsert="true" context="java" deleted="false" description="Dummy text" enabled="true" name="Lorem Ipsum">
            Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
        </template>
    </templates>
    

    转到 Java -> Editor -> Templates 并导入上述文件。

    现在,当你编写代码并输入lore(代表上面template标签的name属性值),然后点击CTRL kbd>+SPACE,那么它会自动插入lorem ipsum文本。

    更多提示:

  • 在 ipsum 文本中添加撇号,以便它自动生成 Java 字符串
  • 在 ispum 文本中添加+ 符号,以便在插入时分解长字符串
  • autoinsert 属性设置为 false。然后就可以看到proposal里面的ipsum描述了
  • 模板 的名称设置为aaa_LoremIpsum。然后,在 Eclipse 中,输入 aaa 并按 CTRL+SPACE。这样您就可以添加许多以aaa 开头的模板,并在Eclipse 中选择您喜欢的模板。

    我自己有用于在类中分离方法的模板。 (例如aaa_1.StaticFieldsaaa_2.InstanceFieldsaaa_3.Constructors 等)

  • 【讨论】:

      【解决方案3】:

      他们可以提供帮助。

      tools:text="@tools:sample/cities"
      tools:text="@tools:sample/backgrounds/scenic"
      tools:text= "@tools:sample/avatars"
      tools:text="@tools:sample/full_names"
      tools:text=”@tools:sample/lorem"
      tools:text=”@tools:sample/lorem/random"
      

      for other

      【讨论】:

        猜你喜欢
        • 2013-07-30
        • 2010-09-10
        • 2011-05-16
        • 2013-12-04
        • 2021-11-28
        • 2021-05-28
        • 2021-12-17
        • 2013-04-11
        • 2011-04-09
        相关资源
        最近更新 更多