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条)

报告相同问题?

悬赏问题

  • ¥15 rs485的上拉下拉,不会对a-b<-200mv有影响吗,就是接受时,对判断逻辑0有影响吗
  • ¥15 使用phpstudy在云服务器上搭建个人网站
  • ¥15 应该如何判断含间隙的曲柄摇杆机构,轴与轴承是否发生了碰撞?
  • ¥15 vue3+express部署到nginx
  • ¥20 搭建pt1000三线制高精度测温电路
  • ¥15 使用Jdk8自带的算法,和Jdk11自带的加密结果会一样吗,不一样的话有什么解决方案,Jdk不能升级的情况
  • ¥15 画两个图 python或R
  • ¥15 在线请求openmv与pixhawk 实现实时目标跟踪的具体通讯方法
  • ¥15 八路抢答器设计出现故障
  • ¥15 opencv 无法读取视频