我刚开始做安卓应用,但是在改变布局(layout
)时遇到问题。每当我创建新的安卓项目时,它都给我一个RelativeLayout
而不是LinearLayout
(基本上我是按照书上的指示来操作的,但是书上没有教我如何更改)。我猜想可能有一个默认设置,使我可以将RelativeLayout
更改为LinearLayout
。
<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" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="@string/hello_world"
tools:context=".MainActivity" />
</RelativeLayout>
android:orientation="vertical"
- 默认情况下是horizontal
。 - mgarciaisaia