O_Casper_ne 2012-12-17 05:16 采纳率: 7.7%
浏览 4003
已采纳

LinearLayout格式和XML文件

我想在布局中插入一个新的一行。在第一行中我有4个简单TextViews,第二行我想放置按钮。在网上查找了资料,使用以下代码:

    <LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:gravity="center" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"

    ……    // 4 textview  

     <LinearLayout
        android:orientation="vertical"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent">    
        ……    // button

    </LinearLayout>
    </LinearLayout>

但是我看设计器中的页面,textview和button都显示在一行上,不是预期的结果。
错误出现在哪啊?

  • 写回答

2条回答

  • fire_fire_fire 2012-12-17 06:24
    关注

    不明白你的意思,从你界面布局上看,只有两个layout,没有任何控件。是代码添加布局的吗?
    我知道你的意思了。

    enter code here    <!-- 这个layout是整体布局,里面元素是竖向排列 --><LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:gravity="center" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content">
    <!-- 这个layout是4个textview的布局,里面元素是横向排列 -->
    <LinearLayout 
        android:orientation="horizontal"
        android:gravity="center" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content">
         ……    // 4 textview 
    </LinearLayout>
        ……    // button
    </LinearLayout>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog