安卓编程button
如何让两个button垂直排列?为什么它们都在左上角不能动?
如何让两个button垂直排列?为什么它们都在左上角不能动?
2016-04-14
在4.0以前版本中一共有五种布局,都是ViewGroup的子类。分别是AbsoluteLayout、RelativeLayout、LinearLayout、FrameLayout、TableLayout。而TableLayout是LinearLayout的子类。(中文分别是:绝对布局、相对布局、线性布局、帧布局、表格布局)。
http://www.cnblogs.com/chiao/archive/2011/08/24/2152435.html
这个看一下,详细讲解布局
<LinearLayout 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"
android:orientation="vertical"
tools:context=".MainActivity" >
<Button
android:id="@+id/btn1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/button_name"
/>
<Button
android:id="@+id/btn2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/button_name"
/>
</LinearLayout>
举报