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

原来的代码是这样

 <RadioGroup
android:id="@+id/rgSex"
android:orientation="horizontal"
android:layout_gravity="center_horizontal"> <RadioButton
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="男"
android:checked="true"
android:id="@+id/male"/> <RadioButton
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="女"
android:id="@+id/female"/> </RadioGroup>

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

改成这样就可以了

         <RadioGroup
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="@+id/rgSex"
android:orientation="horizontal"
android:layout_gravity="center_horizontal"> <RadioButton
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="男"
android:checked="true"
android:id="@+id/male"/> <RadioButton
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="女"
android:id="@+id/female"/> </RadioGroup>

Android停止运行问题1_layout布局xml问题的更多相关文章

  1. Android 100多个Styles快速开发布局XML,一行搞定View属性,一键统一配置UI...

    Android开发中大量使用XML代码作为界面的布局,使用styles能大幅精简XML代码. 比如下面这个界面从AlertDialog至PlacePickerWindow有19个样式相同的跳转Item ...

  2. Android中的LinearLayout布局

    LinearLayout : 线性布局 在一般情况下,当有很多控件需要在一个界面列出来时,我们就可以使用线性布局(LinearLayout)了,  线性布局是按照垂直方向(vertical)或水平方向 ...

  3. Android开发-之五大布局

    在html中大家都知道布局是什么意思了,简单来说就是将页面划分模块,比如html中的div.table等.那么Android中也是这样的.Android五大布局让界面更加美化,开发起来也更加方便.当然 ...

  4. Android中ListView错位布局实现(无聊向)

    由于某些原因,需要个错位的页面,在网上找不到好的例子,试着动手写了写. 不考虑配色的完成图如下: 首先考虑的是,listview每一行左右都有可能缩进. 先假设一行的布局就是ImageView,Tex ...

  5. Android性能优化之布局优化

    最新最准确内容建议直接访问原文:Android性能优化之布局优化 本文为Android性能优化的第二篇——布局优化,主要介绍使用抽象布局标签(include, viewstub, merge).去除不 ...

  6. Android中的五大布局

    Android中的五大布局 1.了解布局 一个丰富的界面总是要由很多个控件组成的,那我们如何才能让各个控件都有条不紊地 摆放在界面上,而不是乱糟糟的呢?这就需要借助布局来实现了.布局是一种可用于放置很 ...

  7. 【转】Android性能优化之布局优化篇

     转自:http://blog.csdn.net/feiduclear_up/article/details/46670433 Android性能优化之布局优化篇 分类: andorid 开发2015 ...

  8. android——学习:网格布局——GridLayout

    Android一开始就提供了几种布局控件,如线性布局LinearLayout.相对布局RelativeLayout和表格布局TableLayout等,但在很多情况下,这些布局控件是不能满足要求的,因此 ...

  9. Android实现入门界面布局

    Android实现入门界面布局 开发工具:Andorid Studio 1.3 运行环境:Android 4.4 KitKat 代码实现 首先是常量的定义,安卓中固定字符串应该定义在常量中. stri ...

随机推荐

  1. C# 访问MongoDB 通用方法类

    using MongoDB.Driver; using System; namespace MongoDBDemo { public class MongoDb { public MongoDb(st ...

  2. 完全卸载Oracle11G

    要特别注意删除注册表的这块,如果删错了会导致系统出现问题,而且oracle的安装卸载真的很烦,一旦装错了,卸载不干净就会导致种种的问题无法再次安装,个人建议用360卸载,360卸载完成后会自动检测到无 ...

  3. Linux 集群

    html,body { } .CodeMirror { height: auto } .CodeMirror-scroll { } .CodeMirror-lines { padding: 4px 0 ...

  4. 构建最小的docker容器

    创建一个最小的基本镜像: tar cv --files-from /dev/null | sudo docker import - skycn/base 建一个hello.go: package ma ...

  5. 移动端自动化环境搭建-RIDE的安装

    A.安装依赖 RIDE 是 Robot Framework 测试数据的编辑器.它使测试用例的创建.运行.测试项目的组织可以在图形界面下完成. B.安装过程 下载地址:https://pypi.pyth ...

  6. android第二天(项目的组成结构)

    1:src文件夹分析: helloWorld----src(源码文件夹) MainActivity:主界面类----gen(自动生成的源码文件夹) R.java:对应res文件夹 下面又包含三个内部类 ...

  7. javascript知识点总结----Function定义

    ---恢复内容开始--- 函数Function: 函数实际上是对象,每个函数都是Function类型的实例,而且都与其他引用类型一样具有属性和方法,函数名实际上是一个指向函数的指针,不会与某个函数绑定 ...

  8. JPA merge(obj) 方法

    JPA中的merge类似Hibernate中的saveOrUpdate方法,当数据库中存在id=2的Person,在em.close()时会发送一条update语句,而当数据库中不存在id=2的Per ...

  9. 为eclipse添加tomcat插件(eclipse tomcat plugin)

    打开站点:http://marketplace.eclipse.org/content/eclipse-tomcat-plugin 把Install拖到打开的eclipse的工作区中,即可下载安装. ...

  10. C# ADO.NET (sql语句连接方式)(增,删,改)

    using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.We ...