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>
  • 相关阅读:
    asp.net mvc controller调用js
    无刷新文件上传 利用iframe实现
    Git使用
    easyui扩展
    Highcharts 多个Y轴动态刷新数据
    Android之Handler
    asp.net mvc之TempData、ViewData、ViewBag
    android之滑屏的实现
    java多线程系类:JUC线程池:05之线程池原理(四)(转)
    java多线程系类:JUC线程池:04之线程池原理(三)(转)
  • 原文地址:https://www.cnblogs.com/ncgds/p/5723224.html
Copyright © 2011-2022 走看看