zoukankan      html  css  js  c++  java
  • Android停止运行问题1_layout布局xml问题

      好好的写了300多行布局文件代码,写完之后运行结果,停止运行了。我当时就奇怪,xml有错误应该会提示啊,我就一个一个的缩小错误的代码范围,先直接换成一个简单的TextView ,运行一下没有错误。再慢慢增加代码,直到增加到一个RadioGroup,直接停止运行

    原来的代码是这样

     1 <RadioGroup
     2             android:id="@+id/rgSex"
     3             android:orientation="horizontal"
     4             android:layout_gravity="center_horizontal">
     5 
     6             <RadioButton
     7                 android:layout_height="wrap_content"
     8                 android:layout_width="wrap_content"
     9                 android:text="男"
    10                 android:checked="true"
    11                 android:id="@+id/male"/>
    12 
    13             <RadioButton
    14                 android:layout_height="wrap_content"
    15                 android:layout_width="wrap_content"
    16                 android:text="女"
    17                 android:id="@+id/female"/>
    18 
    19         </RadioGroup>

    当时我不知道错在哪,我找人求助,别人告诉我,RadioGroup要设置layout_height ,layout_width 我才明白

    改成这样就可以了

     1         <RadioGroup
     2             android:layout_height="wrap_content"
     3             android:layout_width="wrap_content"
     4             android:id="@+id/rgSex"
     5             android:orientation="horizontal"
     6             android:layout_gravity="center_horizontal">
     7 
     8             <RadioButton
     9                 android:layout_height="wrap_content"
    10                 android:layout_width="wrap_content"
    11                 android:text="男"
    12                 android:checked="true"
    13                 android:id="@+id/male"/>
    14 
    15             <RadioButton
    16                 android:layout_height="wrap_content"
    17                 android:layout_width="wrap_content"
    18                 android:text="女"
    19                 android:id="@+id/female"/>
    20 
    21         </RadioGroup>
  • 相关阅读:
    无锁并行框架构建复杂消费模型
    Disruptor框架EventProcessor和Workpool的使用
    .NET工作准备--04ASP.NET
    .NET工作准备--03进阶知识
    .NET工作准备--02基础知识
    .NET工作准备--01前言
    Java核心编程快速入门
    IntellijIDEA快速入门(Windows版)
    企业模式和设计模式快速入门
    架构设计深入学习02-概念架构与细化架构
  • 原文地址:https://www.cnblogs.com/ncgds/p/5723224.html
Copyright © 2011-2022 走看看