I am seeing a strange problem with my Eclipse IDE for Android development.
Autocompletion does not work when I hit Ctrl + Space in the main.xml file for my layouts. In the bottom left, I get a message saying for example "LinearLayout not found".
I also have the correct namespace specified in my file.
It does work though for other xml files, such as my strings.xml which I find strange.
This is an annoyance as I'd like to easily see all the options available for a View or Layout.
Anyone got any ideas on how to resolve this?
Check that the file is being opened in the Android XML Layout editor (not just the "plain" XML editor). Right-click the file, choose Open With, and select Android Layout Editor.
It seems like an eclipse XML editor issue.
If you declare the xmlns in other than "xmlns:android" you loose the autocompletion.
for example if you say:
xmlns:android="http://schemas.android.com/apk/res/android"
android:.... //AUTOCOMPLETES
if you say
xmlns:android1="http://schemas.android.com/apk/res/android"
android1:... //DOES NOT AUTOCOMPLETE
Open eclipse and go to the following:
Window > preferences > XML > editor > content assist > advanced
Select all checkboxes and click ok. After that, restart eclipse.
Try this as suggested powder366
Or you can set the default editor in Eclipse Preferences, used Android Common XML Editor. You find it in Eclipse Preferences, General, Editors, File Associations. Click on .xml, choose "Add" "Android Common XML Editor". Select it and press the Default button.
OPEN YOUR FILE WITH GENERIC TEXT EDITOR
Right-click on XML File, select Open with GENERIC TEXT EDITOR
Check that the file is being opened in the Generic text editor.If not then, Right-click the file, choose Open With, and select Generic text Editor.
Related
I'm trying to translate a strings.xml file on Android Studio but it seems like the Translations Editor is not enabled (it does not appear as an option when I right click on the strings.xml file). I've tried deleting and installing back Android Studio but it's still the same; any ideas on how to solve?
Thank you in advance!
this is the "no enabled action found message I get
you have to open the string.xml file, then you will see the open editor option on the upper right side
Reopen the Android Studio IDE, it'll solve the problem. Also it will update the strings and refresh the layout of any layout xml.
Translations Editor shows up when you right-click on string resource files whose names end with strings.xml. On others it does not. The same goes for editor option that is supposed to show up in upper right side when string resource file is opened.
So, filenames like strings.xml, preferences_strings.xml, etc. are fine, while strings_intro.xml, etc. are not.
In case you don't have any string resource files named in that way, you can create an empty one named strings.xml and use it to open Translations Editor.
Or, you can open the it in the following way:
Open any xml layout file
Switch to 'Design' view in upper right corner
Design toolbar will look something like the following:
Click on the localizations option (globe icon)
At the bottom of the drop-down menu you will see 'Edit Translations...' option
Click on it - and there you are!
I am only getting autocomplete in my xml layout when i type "android:" I want to get it whenever I press cmd+space. I am using a mac
Go to
Eclipse -> Preferences -> XML -> XML Files - > Editor -> Content Assist
and tick all proposals checkboxes to allow this.
EDIT : Also tick Automatically make suggestions and Insert single proposals automatically checkboxes.
Open Preferences and in the search type XML, you would find on the left pane a XML hierarchy and under editor you will have content assist. Just tick all the boxes there are in this page and you are good to go!
Window--->Preferences----->General------->Keys, find Content Assist and set attribute Binding as cmd + space, and attribute When as Editing in Structured Text Editors, if it still not work, right click on your xml file, choose open with, try to use Android Menu Editor. Good luck.
I found the solution:
I needed to unselect in my mac SystemPref --> keyboard-->shortcuts there was a command "select the previous input source"
All You want is code promption whatever you enter.
Eclipse -> Preferences -> XML -> XML Files - > Editor -> Content Assist
Then input "prompt when these characters are inserted" with
#+<=:abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
When you are about to build regular activity you have simple builder in Eclipse (actually a plugin) for that. Is there anything like that for PreferenceScreen? And if yes, how to activate it?
It is not a WYSIWYG editor but Eclipse's Android tools come with a Preference Screen editor, which is far more powerful than a simple XML editor:
New → Other → Android XML File → Click Next → Select Preference as Resource Type, change the Root Element to Preference Screen and enter a file name. Done
In Eclipse, there is no any option to see the graphical layout of the Preference activity but like xml layout eclipse provide the facility for edit the xml file of the Preference activity.
Until today (I have no idea what I did to cause this), if I double-clicked an android XML file, then the correct editor would appear.
For example, double-clicking a layout file would open a Graphical Layout tab and a tab with the XML contents for direct editing (named as the file being edited). Now all I get is a Design and a Source tab!
I am unable to preview the layouts I am editing (this is the same as here: Graphical Layout tab does not appear for some layout files into Eclipse)
That link also gives a 'workaround' in that I can right-click the file and open with the right editor, but this isn't a solution!
How can I sort this permenantly? I have re-installed fresh Eclipse, ADT to no avail (haven't used fresh SDK... will that matter??).
** Note this happens to all Android XML files, not just layout ones I mentioned above! **
Yes this may be a permanent solution:
Select any XML layout file
click on Window->Preferences menu.
Follow steps as mentioned in attached image.
What I had to end up doing was selecting the Legacy Android Xml Resources Editor from the same list that Paresh is showing and setting it as the default. I had to choose it from the list that appears when you click the add button. After that I restarted eclipse and everything was fine.
It's a normal .xml:
and it's a android .xml:
In normal .xml, eclipse adds a redundant highlight on my "color" tag.
I don't like this, but can't find where the configure is.
Your first XML file is being edited by the XML Editor built into Eclipse. The second is being edited by the Android Resource Editor. It just works differently. You can right-click on the file name in the Package Explorer and select which editor you want to use under Open With.