ssummeraw 2013-03-18 02:34 采纳率: 10%
浏览 2008
已采纳

如何把视图设置成垂直的?

从 xml 代码中看,我觉的这里设置的视图相对于其它的应该是垂直显示,但相反,他们堆叠到一块。错误出现在哪呢?

 <RelativeLayout
            android:id="@+id/top_lay2"
            android:layout_below="@id/top_lay1"
            android:layout_width="fill_parent"
            android:layout_marginTop="10dp"
            android:orientation="vertical"
            android:layout_height="wrap_content"
            android:background="@drawable/customrect">
<TextView
            android:layout_gravity="center"
            android:layout_width="fill_parent"
            android:layout_height="wrao_content"
            android:textColor="@color/white1"
            android:text="some text"
         />
<Button
            android:layout_gravity="center"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="click me"
    />

    </RelativeLayout>
  • 写回答

2条回答 默认 最新

  • LiDaming_and 2013-03-22 09:52
    关注

    在一个 LinearLayout中,字段将是垂直显示,但是在 RelativeLayout 中,要指定视图的相对位置。所以如果你用"LinearLayout"代替 "RelativeLayout",就能设置成垂直的了。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?