Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio Tab Spacing

How can I change spacing in Android Studio to use tabs instead of spaces? I tried Preference -> Editor but I don't see the option there. I'm using Android Studio for Mac

like image 382
Christopher Francisco Avatar asked May 13 '14 13:05

Christopher Francisco


People also ask

How to change tab space in Android studio?

Type in 'spac' in the search panel of the settings view. You will find Editor -> Code Style -> Java -> Tabs and Indents -> Use tab character .

How to make tab layout in Android studio?

This example demonstrates how do I create a Tab Layout in android app. Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 3 − Add the following code to res/layout/activity_main. xml.

What is tab layout?

TabLayout is used to implement horizontal tabs. TabLayout is released by Android after the deprecation of ActionBar. TabListener (API level 21). TabLayout is introduced in design support library to implement tabs. Tabs are created using newTab() method of TabLayout class.

How to change TabLayout in Android?

If you know the index of the tab you want to select, you can do it like so: TabLayout tabLayout = (TabLayout) findViewById(R. id. tabs); TabLayout.


2 Answers

Type in 'spac' in the search panel of the settings view.

You will find Editor -> Code Style->Java->Tabs and Indents->Use tab character.

like image 152
nhaarman Avatar answered Sep 24 '22 10:09

nhaarman


This is a little weird, but others may have the same issue I did.

Yes, follow the above directions, and do the normal changes in the config file. And guess what? it looks like it's still making spaces instead of tabs, even though the settings say TABS, not spaces!

Turn on "show whitespaces" (Editor -> General -> Appearance). And then turn it off. Looks like this is enough to reset the editor so that it is now following the rules you set in the preferences.

like image 36
SMBiggs Avatar answered Sep 25 '22 10:09

SMBiggs