While editing an XML layout file, I would like Eclipse to display content proposals.
E.g. when I type in "marg" and press Cmd+Space, it should offer me a dropdown list of
layout_marginLeft, layout_marginRight etc.
How can I set this keybinding?
(On Mac it is by default Ctrl+Space, but I want it to be Cmd+Space)
Command+Space usually brings up Spotlight. You'll have to turn this off first.
Go to System Preferences / Spotlight.
Disable or remap Command+Space.
Then in Eclipse:
Go to Eclipse / Preferences.
Select General / Keys.
Select Content Assist in the list.
Delete the ^Space in the binding textbox.
Type in Command+Space.
If you go to
Eclipse > Preferences > Keys
find the option 'Content Assist' and changing the binding to cmd + space.
Related
How to find all hardcoded dimensions both in xml layout files and in code in Android Studio? I want to move them over to dimens.xml.
Basically, I want something like https://stackoverflow.com/a/39130143, but for dimensions instead of strings.
This should work -
Press Ctrl + Shift + F or Cmd + Shift + F (in mac) to search in project.
Go to Options and choose Regular Expression.
Now search "((\d)+)dp" in search bar which should give you all the hardcoded dimensions.
If you have dimensions as decimal values you can change the regex pattern accordingly. This one worked in my case.
Also, if you want to search in specific area, you can do that too with this method. Thanks.
You can search all the hard coded dimension in Android studio using Find in path.
Go to
Edit > Find > Find in path
In option tab ->
General -> select Regular expression
Scope -> You can select the sope of the search
File name filter - > you can select FileMasks as *.xml
And you can start the search now, add \ddp or [0-9]dp in Text to find.
Done you can see all the usage.
I think you have to create the custom lint for that, since currently it can check for 0dp in code and use of pixel instead of dimension.
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
Is there any way to make the editor text larger in Android Studio?
I go to Settings>Editor>Colors&Fonts>Font where I find "Size:12". However, I'm unable to change the value for the size.
They didn't make this very obvious, did they?
All you have to do is click the "Save As" button to create a new profile. You can't change the font because you can't overwrite the default profiles.
If creating a custom setting doesn't help:
Click on File > Settings > Editor and check the field:
Change font-size with CTRL + Mouse Wheel.
Worked for me.
Extending the answer above, for Windows:
1. Go to File > Settings ...
2. Modify the settings shown below
If you are using Android Studio (version 0.5.2) then this applies:
Click on [File][Settings], and under the "IDE Settings" area (left side Pane), choose "Appearance".
On the right side (the 'Appearance Settings') check the CheckBox called "Override default fonts by (not recommended)" and then the "Size" choice will un-grey and you can choose a new size using either the PullDown or by typing a number. Double check that the number is reasonable (not too large).
Click [Apply] to see the result of your choice and ensure that it is readable before choosing [OK] and dismissing the Settings Panel.
Cautions: Since Android Studio is still in Beta (a new Program) choosing too small or too large a Font, or choosing one that the Editor does not agree with, may make Text either unreadable or worse (cause a crash).
This is likely why the Setting says "not recommended". You do not want to have to edit the Program's settings with a Hex Editor if you make a mess by setting the Fonts to 144 Points instead of just 14 -- the Menu line would be huge.
A small increase in the Font size should be OK but be careful not to make Text so large that it can not fit in the area that was reserved for it (not just in the Editor but also the "Main Menu" and the "Info Bar" (at the bottom).
Note: The 'Edit Window' Text is smaller than all the other Text by one size but all Text is controlled by the one Setting. Making the 'Edit Window' Text too big is very likely to cause problems elsewhere since all the other Text is larger than what is shown in the 'Edit Window'.
Keymap
There is nothing wrong with the other answers but this one shows how to map the font sizing to a keyboard shortcut. One can then use Cmd/= and Cmd/- (or Ctrl/=, Ctrl-) to manage the font sizing. You can choose any key combination you like but note the conflicts message that appears when you select a keyboard shortcut (just to be sure that it makes sense in your use-case).
Go to Preferences (Settings in Windows) Menu and select the Keymap section title on the left. On the right sections' search box, type in font. You will find several entries including Increase Font Size and Decrease Font Size. You can double click each of these to add a keyboard shortcut.
For mine, I chose Cmd/= and Cmd/- as my shortcuts respectively. You will be prompted with an option to Leave or Remove conflicts. In my case, I chose to leave the conflicts in place as they are never likely to be loaded at the same time.
Double-click to add keymap
Enter key combination and note any conflicts
Choose how to handle conflicts
NB: If you choose Leave, conflicts remain ~ but may not matter if they
are not loaded at the same time. If you choose Remove then the original
keyboard shortcuts are removed (use with care).
Nota Bene
Another useful keymap on font sizing is Reset Font Size, which puts things back to the default setting. This option shows up when you search the Keymap in preferences for font. In my case, I chose Cmd/Shift/0 so that I would avoid the commonly used Cmd\0 shortcut that opens the Messages window.
Reset Font Size
Valid as of Android Studio 1.5.1
FYI
A different method to change the font sizes is to open the Actions
menu and search for font. When found then double click on the
increase/decrease font size choices. On the Mac, I access actions
menu using the Cmd/Shift/A shortcut or under Help menu, choose
Find Actions.
A nice feature is:
File -> Settings -> Editor -> General
On top there is a section "Mouse"
You can click on the "Change font size (ZOOM) with CTRL+Mouse wheel"
So you can change the size on demand.
In MacBook Android Studio ->
Select Preferences... ->
Click on Save As.. ->Give any name -> OK -> then select Scheme -> and you given name every option Editable
Go to Settings > Editor, expand the Editor tree, go to Color & Fonts expand that tree and find Font, at the top select the theme you want to change fonts for and then change the font under Editor Font
It seems they have fixed it now. I'm using Android Studio 3.0, and I'm able to modify default scheme.
Just open Settings > Editor > Colors&Fonts > Font, enter the desired font size in field "Size" and click "Apply" button, that's it.
Goto Files | Settings | Appearance & Behavior --> appearance --> scroll down mouse you will find presentation mode change the font size .
I have the issue but it was due to changed font family. I had to specify Font size for specific Font Family I was currently using. Got to Settings > Font > Click Current Editor font...
It will open Color Scheme > Color Scheme Font. Specify Font size here
I'm using Eclipse 3.7 (Indigo). I have some very long string item definitions/values - e.g. over 1000 characters with a lot of embedded XML segments. The copy function works in the strings.xml tab where the XML characters are replaced by their multi-character equivalents but not the Resources tab. Whenever I select the definition/value text - either by using the cursor or using the shift-arrow keys, I do not activate the 'copy' or 'cut' commands.
Does anyone have the secret?
At the beginning i use to do everything on the resource tab , BUT then i started to have some problems that when i pasted the info it was not showing there, but it was being pasted on the resource node for some reason, so it make it my XML invalid.So i better started to do it on the XML tab, cause is faster also. So when you need to do something fast and pretty, you better do it on the XML tab, is less buggy.
UPDATE:
If your problem is just that you want the text with the values like ''' decoded. then you can just copy the text from the XML tab and go to this site and entered there and click decode and you will get your decoded version of your text.
What version of Eclipse do you have? I know some versions have been buggy for keyboard mapping and shortcuts.
Try looking at how those shortcuts are defined. See column "When" in Preferences > General > Keys (image).
Check if those shortcuts do not work for any editor (do they work for Java editor?). If they work for some editors, and not for another, then the problem might be that a plugin setting is causing them to perform another command. You could try disabling all unnecessary plugins.
EDIT:
I also found a bug report on the Eclipse website that affected Eclipse 3.5. It looks like the fix was to go to Window > Preferences > Java > Editor > Typing, then uncheck "Update imports".
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.