How to avoid entering an “android” for each attribute?

I'm new to Android development, and I also double the designer as an outside guy.

How do I avoid android: type input android: every time I add an attribute?

In other text editors ( TextMate ), I can run snippets by entering a well-known trigger and tab to auto-complete the word. Is there something similar for Eclipse?

+6
source share
3 answers

Just start typing the second part of the keyword (which follows after android: and pressing Ctrl + Space , Eclipse inserts the desired keyword for you with the android: prefix.

+5
source

You can open the autocomplete dialog by pressing Ctrl + Space at the beginning of a new line.

In addition, I wanted to add a note about why you need to introduce android: in general (and how you can change it to whatever you want).

If you look at the first element in your layout file, this line appears:

 xmlns:android="http://schemas.android.com/apk/res/android" 

If you change the word android here, it will be the prefix that you need to enter - so if you set instead

 xmlns:a="http://schemas.android.com/apk/res/android" 

then all your attributes should be exceeded only a: for example, in this example:

 <?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> 
+5
source

First use Ctrl + Space . Then start typing something. Use the arrow keys to scroll through the list and Enter to select one.

:-)

+3
source

All Articles