距离上方的距离,如果上方有组建就是指该组件,你的组建就会在你上面那个组建的下面,你应该用这个属性:android:layout_alignTop="@id/某个组件",这样你的组建就在这个组件的上面了,然后再距离这个多少距离就好了
假如有一个button和一个textview,想要将textview放置在button下方,可以这样写... android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="按钮" /> android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:layout_below="@+id/button1" //当前控件textview放置在button下方 android:layout_marginTop="20dp" android:text="@string/hello_world" />
这个你可以这样理解,如果你不设置这个属性,控件会有一个初始的位置,设置了以后等于向下平移了这么多的距离
距离当前组件的上方的组件的距离