Search code examples
android-studiocode-generation

Set default layout for new activity to "Linear layout" instead of "Relative layout" in Android Studio


I usually use Linear layout for most of my activity. I want to make Android studio create Linear layout by default when I create new activity, instead of Relative layout. Is there a way to do that?


Solution

  • Make one blank xml file like this .

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_trip_detail"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
    
    </LinearLayout>
    

    Then go to Window > Store current layout as default in android studio from top tool bar .This layout will become your default .You can restore your settings by same tab .