Tab key not working in Android Studio - android

I installed the Android Studio version 0.8.0
and my TAB key in my keyboard does not insert an actual tab in the editor window of Android studio.
But my TAB key in general works fine.
Someone kindly help as i am not able to figure this out.
Thanks.

File > Settings > Project Settings > Code Style - Java
Use tab character
If this check box is selected, tab characters are
used: On pressing the Tab key For indentation For code reformatting
When the check box is cleared, IntelliJ IDEA uses spaces instead of
tabs.
Smart tabs
If this check box is selected, IntelliJ IDEA inserts
tabs for indentation and reformatting, but fine alignment to a
necessary column is done only via spaces without replacing them with
tabs. This is done in order to preserve visual representation of the
source code, when the tab size is changed.
If this check box is cleared, only tabs are used. This means that a group of spaces that
fits the specified tab size is automatically replaced with a tab,
which may result in breaking fine alignment. The Smart Tabs check box
is available if the Use Tab Character check box is selected.
Tab size
In this text box, specify the number of spaces included in a
tab.
You may also need to go to File > Settings > Project Settings > Code Style. XML if the Android xml is giving you the same issue.
http://www.jetbrains.com/idea/webhelp/code-style-java.html

File > Settings > Project Settings > Code Style
And make sure that
Use tab is checked under Code Style
Use tab under Code Style - Java is checked also
Preferably you check "detect and use file indentations for edit" to avoid noise.

Related

Android Studio remove default fragment title

How can a developer remove the default fragment panel text. I have not coded Android since version 2.1. Using Android Studio 3.5. My menu/title page is "Tools to help you grow"; beneath that the panel has "This is tools Fragment" which is dynamically loaded into the AVD Manager device when I test the opening app.
The problem:
How to remove panel text: "This is tools Fragment". I never entered this text anywhere inside the project. My title "Tools to help your grow" is correct and should be on this page.
Since you haven't made in changes in the App's code.
The most simple way to find and remove text is using Ctrl + Shift + F (Find in project path) feature of the android studio.
Search Tools to help you grow this and remove it. Do the same for any other text you want to remove.
TextView.visibility=invisible
I missed this TextView on my initial test. It had TextView.text set to blank, that's why text: "This is tools Fragment" was never visible in the code / xml.
This text is simply specified for Fragments.
You can find this text at
Project > Java > com.yourpackage > ui > home/gallery/slideshow > ViewModels

Android Studio 2.1.1 using tabs, not spaces, even though tabs are not checked in Settings

When editing Java files, if I'm at the end of the line and I type the Enter key, it starts the next line properly indented 4 columns, to match the line above. That's OK but it's indenting with a tab, not spaces, even though in File>Settings>Editor>Java>Tabs and Indents the checkbox for Use tab character is unchecked, and always has been.
If I just type the tab key I also get a tab, not spaces.
I never want to use tab characters; I always want to use spaces. I don't have this problem in Eclipse or Microsoft Visual Studio so it's not some system setting for my PC. Is there some other setting in Android Studio for this?
Edit: I tried the suggestion that Omar Al Halabi (below) made and it didn't work but while testing it I noticed something interesting: This tab problem seems to mainly apply to the beginning of the line, i.e., if I type Enter on the previous line, it immediately tabs over to the first indent position on the following line, using real tabs, not spaces. On the other hand if I'm typing some text on an existing line, once I've typed a little text, if I hit tab, it then tabs over using spaces.
hope this helps,
check Use Tab Character,
give all that values to zero than you not get space on enter in java code, like in below image,
one more thing is you have to change your code format settings or may need to disable it
This is not an answer, but I don't have enough reputation points to post my questions as a comment.
- Is this issue happening in all your Android Studio projects?
- Are you using the Default scheme for the general File->Settings->Editor->Code Style and also for the Java Code Style?
- Have you tried making a new Java Code Style scheme at the Project level for just one project as a test?
EDIT: This is a brute-force/shotgun approach.
Rename your \Users\<username>\.AndroidStudio2.1 directory (e.g., .AndroidStudio2.1_orig)
Open Android Studio and force it to use the default settings by choosing the "I do not have a previous version of Studio or I do not want to import my settings" option when the "Complete Installation" dialog window appears.
Run a recursive 'diff' between the new and old .AndroidStudio2.1 directories to find any changes you've made to the default settings so you can re-apply them. The settings are kept in XML files so they are human-readable. Keep an eye out for any differences that may affect Android Studio use of tabs & spaces, because those might be the source of the problem.
If this does not work, then you may have to re-install Android Studio.
Try opening Settings->Editor->Code Style->Java. Check "Use tab character". Click OK.
Then go to File->Invalidate Caches\Restart -> Invalidate and Restart.
Then, again, go to Settings->Editor->Code Style->Java. Now uncheck "Use tab character" and hit OK.
If it still doesn't work change tab size and indent and then restore them back if you want.
The IDE tries to position the lines as if they belong to the same block. Also very likely you had used the tabs on the previous line. You can try to deactivate Detect and use Existing file indents for editing

Accessing Android Studio properties window?

I have recently started using Android Studio and cannot work out how to access the properties window.
The following screenshot was taken from Google and shows exactly what I'm trying to access denoted by the red rectangle around the properties window.
Can anyone please tell me how I can access this?
Switch to design view. Click "Design" tab at bottom-left work area.
In the new Android Studio Version 3.1.2, the name of the Propierties Windows is "Attributes".
Look at this picture:
Attributes basic view
And, if you want to see the complete attributes, simply click on "View all attributes":
Attributes full view
How to restore windows?:
restore windows
I had the same issue than found that the properties window was always there but I had to drag it out with my mouse. Just go to the far right vertical bar in Design mode then drag to the right when your mouse turns into horizontal arrows pointing away from each other. Hope this helps!
You can just click on the design tab on your screen (at the left bottom corner below your code text window) and just click on anything whose property you want to change
make sure you are in the '.xml' file
I accidentally deleted the properties side bar and Window-->restore deafult layout helped.
Follow the doc.
Instead of editing your view properties in XML, you can do so from the Properties window (on the right side of the Layout Editor). This window is available only when the design editor is open, so be sure you've selected the Design tab at the bottom of the window.
When you select a view, the Properties window shows the following, as indicated in figure 5:
View inspector with controls for width/height style, margins, and bias (available only for views in a ConstraintLayout). For more information, see Build a Responsive UI with ConstraintLayout.
This happens all the time, to my opinion Android team should see as an improvement opportunity, here is the solution, click on the settings (gear symbol) on the right make sure that the attached side is set to None. also -See screen shot-> 1,
You have three ways to see the fields, design mode, split mode and code mode. THE ONLY ONE THAT shows the Attribute bar is on the SPLIT MODE, click on the Attribute see screenshot->
if that does not work, you can go to Windows -> Restore default Layout
if that still does not work you can do File -> Manage IDE Settings -> Restore Default Settings.
if that still does not work you can go in file explorer and delete the .android studio folder in C\users[your user].Androidstudio#.#
Hope this helps someone out there...

Android Studio Editor Font Sizing

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

Would you believe: I can't 'copy' the definition/value of a string item in the eclipse String Editor

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 '&#39' 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".

Categories

Resources