如何避免为每个属性键入"android"?

nip*_*ese 6 eclipse android attributes autocomplete

我是Android开发的新手,也是一名设计师,成为前端人物.

如何在android:每次添加属性时都避免输入?

在其他文本编辑器(TextMate)中,我可以通过键入已知触发器并tab自动完成单词来触发片段.Eclipse有类似的东西吗?

nic*_*are 5

只需开始键入关键字的第二部分(之后的内容,android:然后按Ctrl+ Space,Eclipse将为您添加前缀的所需关键字android:.


Phi*_*hil 5

您可以通过在新行的开头按Ctrl+ 来调出自动完成对话框Space.

此外,我想添加一个关于为什么需要输入的注释android:(以及如何将其更改为您想要的任何内容).

如果查看布局文件中的第一个元素,将会出现如下所示的行:

xmlns:android="http://schemas.android.com/apk/res/android"
Run Code Online (Sandbox Code Playgroud)

如果你在android这里更改单词,那么这将是你需要输入的前缀 - 所以如果你改为设置

xmlns:a="http://schemas.android.com/apk/res/android"
Run Code Online (Sandbox Code Playgroud)

那么所有属性只需要a:在其前面,例如在这个例子中:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:a="http://schemas.android.com/apk/res/android"
    a:layout_width="fill_parent"
    a:layout_height="fill_parent"
    a:orientation="vertical" >

    <TextView
        a:layout_width="fill_parent"
        a:layout_height="wrap_content"
        a:text="@string/hello" />

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)