问题
why when i create new application in android it made with relative layout instead of linear layout.... how can i create linear layout when i create new app by default instead of relative ?
enter code here
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="${relativePackage}.${activityClass}" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
回答1:
Ok Follow this steps and you can do it but i am 99% sure only.
Go to res-> layout folder and Right Click on it and you get a sidebar asking for what type of file you want to create
Go to -> Edit File Templates option.
Sidebar>
You will see this dialog opened.
You see both options right there inside Other tab These options are LayoutResourceFile.xml and LayoutResourceFile_vertical.xml
Change the ${ROOT_TAG} to LinearLayout in both of these LayoutResourceFile.xml and LayoutResourceFile_vertical.xml and you will always get LinearLayout as parent for future.
来源:https://stackoverflow.com/questions/28225806/create-linear-layout-in-android-by-default-when-making-new-app-instead-of-relati