dbAdapter的xml文件的分析
来源:互联网 发布:福建网络广播电视台:{ 编辑:程序博客网 时间:2024/06/03 22:01
今天陷入了无聊的状态,其实是因为自己累了,所以想睡一会儿,现在好多了,
六白天的时间其中我能够实现一天之内解决三个问题,
android:layout_alignParentLeft="true" 这个的意思是在父亲节点中尽量的向左边移动
android:layout_toRightOf="@id/age" 这个是以什么作为参照的意思,rightof的意思是它在id号码为age的元素的右边
android:layout_alignBaseline="@+id/age" >这个是和什么对齐的意思,除了要在ageid元素的右边之外,还要与age元素为参照保持对齐
android:layout_marginLeft="10dip"
可以类比为maiginright的使用。
android:layout_below="@id/name"
紧紧贴在id号码为name的元素的下面
android:numeric="integer">
这个指的是在这个编辑文本中输入的文字的类型是整形
android:padding = "5dip" 垫底底部的处理,是选择距离底部5dip的布局方式
这里总结了关于三个属性的含义的比较:
三个属性都用来适应视图的水平或垂直大小,一个以视图的内容或尺寸为基础的布局比精确地指定视图范围更加方便。
(1) fill_parent
设置一个构件的布局为fill_parent将强制性地使构件扩展,以填充布局单元内尽可能多的空间。这跟Windows控件的dockstyle属性大体一致。设置一个顶部布局或控件为fill_parent将强制性让它布满整个屏幕。
(2) wrap_content
设置一个视图的尺寸为wrap_content将强制性地使视图扩展以显示全部内容。以TextView和ImageView控件为例,设置为wrap_content将完整显示其内部的文本和图像。布局元素将根据内容更改大小。设置一个视图的尺寸为wrap_content大体等同于设置Windows控件的Autosize属性为True。
(3) match_parent
Android2.2中match_parent和fill_parent是一个意思 .两个参数意思一样,match_parent更贴切,于是从2.2开始两个词都可以用。那么如果考虑低版本的使用情况你就需要用fill_parent了
这里是实现了比较复杂的布局的结构,从结构布局的相应的参照,到线性布局的一个接着一个
一般在不同的控件下采用的填充属性也是不一样的,这里的方法是值得学习的。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<RelativeLayout android:id="@+id/RelativeLayout01"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<EditText android:id="@+id/name"
android:text=""
android:layout_width="280dip"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginLeft="10dip" >
</EditText>
<TextView android:id="@+id/name_label"
android:text="姓名:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_toRightOf="@id/name"
android:layout_alignBaseline="@+id/name">
</TextView>
<EditText android:id="@+id/age"
android:text=""
android:layout_width="280dip"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginLeft="10dip"
android:layout_below="@id/name"
android:numeric="integer">
</EditText>
<TextView android:id="@+id/age_label"
android:text="年龄:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_toRightOf="@id/age"
android:layout_alignBaseline="@+id/age" >
</TextView>
<EditText android:id="@+id/height"
android:layout_width="280dip"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginLeft="10dip"
android:layout_below="@id/age"
android:numeric="decimal">
</EditText>
<TextView android:id="@+id/height_label"
android:text="身高:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_toRightOf="@id/height"
android:layout_alignBaseline="@+id/height">
</TextView>
</RelativeLayout>
<!-- ///////////////////////////////////////////////-->
<LinearLayout android:id="@+id/LinearLayout01"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button android:id="@+id/add"
android:text="添加数据"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding = "5dip"
android:layout_weight="1">
</Button>
<Button android:id="@+id/query_all"
android:text="全部显示"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding = "5dip"
android:layout_weight="1">
</Button>
<Button android:id="@+id/clear"
android:text="清除显示"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding = "5dip"
android:layout_weight="1">
</Button>
<Button android:id="@+id/delete_all"
android:text="全部删除"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding = "5dip"
android:layout_weight="1">
</Button>
</LinearLayout>
<!-- ///////////////////////////////////////////////-->
<LinearLayout android:id="@+id/LinearLayout03"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView android:text="ID:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding = "3dip">
</TextView>
<EditText android:id="@+id/id_entry"
android:layout_width="50dip"
android:layout_height="wrap_content"
android:padding = "3dip"
android:layout_weight="1">
</EditText>
<Button android:id="@+id/delete"
android:text="ID删除"
android:layout_width="50dip"
android:layout_height="wrap_content"
android:padding = "3dip"
android:layout_weight="1">
</Button>
<Button android:id="@+id/query"
android:text="ID查询"
android:layout_width="50dip"
android:layout_height="wrap_content"
android:padding = "3dip"
android:layout_weight="1">
</Button>
<Button android:id="@+id/update"
android:text="ID更新"
android:layout_width="50dip"
android:layout_height="wrap_content"
android:padding = "3dip"
android:layout_weight="1">
</Button>
</LinearLayout>
<!-- ///////////////////////////////////////////////-->
<TextView android:id="@+id/label"
android:text="查询结果:"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</TextView>
<ScrollView android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView android:id="@+id/display"
android:text=""
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</TextView>
</LinearLayout>
</ScrollView>
<!-- //////////////////////////////////////////////这个会形成一个滚动的效果,而且由于这个ScrollView的作用/-->
</LinearLayout>
六白天的时间其中我能够实现一天之内解决三个问题,
android:layout_alignParentLeft="true" 这个的意思是在父亲节点中尽量的向左边移动
android:layout_toRightOf="@id/age" 这个是以什么作为参照的意思,rightof的意思是它在id号码为age的元素的右边
android:layout_alignBaseline="@+id/age" >这个是和什么对齐的意思,除了要在ageid元素的右边之外,还要与age元素为参照保持对齐
android:layout_marginLeft="10dip"
可以类比为maiginright的使用。
android:layout_below="@id/name"
紧紧贴在id号码为name的元素的下面
android:numeric="integer">
这个指的是在这个编辑文本中输入的文字的类型是整形
android:padding = "5dip" 垫底底部的处理,是选择距离底部5dip的布局方式
这里总结了关于三个属性的含义的比较:
三个属性都用来适应视图的水平或垂直大小,一个以视图的内容或尺寸为基础的布局比精确地指定视图范围更加方便。
(1) fill_parent
设置一个构件的布局为fill_parent将强制性地使构件扩展,以填充布局单元内尽可能多的空间。这跟Windows控件的dockstyle属性大体一致。设置一个顶部布局或控件为fill_parent将强制性让它布满整个屏幕。
(2) wrap_content
设置一个视图的尺寸为wrap_content将强制性地使视图扩展以显示全部内容。以TextView和ImageView控件为例,设置为wrap_content将完整显示其内部的文本和图像。布局元素将根据内容更改大小。设置一个视图的尺寸为wrap_content大体等同于设置Windows控件的Autosize属性为True。
(3) match_parent
Android2.2中match_parent和fill_parent是一个意思 .两个参数意思一样,match_parent更贴切,于是从2.2开始两个词都可以用。那么如果考虑低版本的使用情况你就需要用fill_parent了
这里是实现了比较复杂的布局的结构,从结构布局的相应的参照,到线性布局的一个接着一个
一般在不同的控件下采用的填充属性也是不一样的,这里的方法是值得学习的。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<RelativeLayout android:id="@+id/RelativeLayout01"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<EditText android:id="@+id/name"
android:text=""
android:layout_width="280dip"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginLeft="10dip" >
</EditText>
<TextView android:id="@+id/name_label"
android:text="姓名:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_toRightOf="@id/name"
android:layout_alignBaseline="@+id/name">
</TextView>
<EditText android:id="@+id/age"
android:text=""
android:layout_width="280dip"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginLeft="10dip"
android:layout_below="@id/name"
android:numeric="integer">
</EditText>
<TextView android:id="@+id/age_label"
android:text="年龄:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_toRightOf="@id/age"
android:layout_alignBaseline="@+id/age" >
</TextView>
<EditText android:id="@+id/height"
android:layout_width="280dip"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginLeft="10dip"
android:layout_below="@id/age"
android:numeric="decimal">
</EditText>
<TextView android:id="@+id/height_label"
android:text="身高:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_toRightOf="@id/height"
android:layout_alignBaseline="@+id/height">
</TextView>
</RelativeLayout>
<!-- ///////////////////////////////////////////////-->
<LinearLayout android:id="@+id/LinearLayout01"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button android:id="@+id/add"
android:text="添加数据"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding = "5dip"
android:layout_weight="1">
</Button>
<Button android:id="@+id/query_all"
android:text="全部显示"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding = "5dip"
android:layout_weight="1">
</Button>
<Button android:id="@+id/clear"
android:text="清除显示"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding = "5dip"
android:layout_weight="1">
</Button>
<Button android:id="@+id/delete_all"
android:text="全部删除"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding = "5dip"
android:layout_weight="1">
</Button>
</LinearLayout>
<!-- ///////////////////////////////////////////////-->
<LinearLayout android:id="@+id/LinearLayout03"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView android:text="ID:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding = "3dip">
</TextView>
<EditText android:id="@+id/id_entry"
android:layout_width="50dip"
android:layout_height="wrap_content"
android:padding = "3dip"
android:layout_weight="1">
</EditText>
<Button android:id="@+id/delete"
android:text="ID删除"
android:layout_width="50dip"
android:layout_height="wrap_content"
android:padding = "3dip"
android:layout_weight="1">
</Button>
<Button android:id="@+id/query"
android:text="ID查询"
android:layout_width="50dip"
android:layout_height="wrap_content"
android:padding = "3dip"
android:layout_weight="1">
</Button>
<Button android:id="@+id/update"
android:text="ID更新"
android:layout_width="50dip"
android:layout_height="wrap_content"
android:padding = "3dip"
android:layout_weight="1">
</Button>
</LinearLayout>
<!-- ///////////////////////////////////////////////-->
<TextView android:id="@+id/label"
android:text="查询结果:"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</TextView>
<ScrollView android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView android:id="@+id/display"
android:text=""
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</TextView>
</LinearLayout>
</ScrollView>
<!-- //////////////////////////////////////////////这个会形成一个滚动的效果,而且由于这个ScrollView的作用/-->
</LinearLayout>
阅读全文
0 0
- dbAdapter的xml文件的分析
- AndroidManifest.xml文件的分析
- zend framework 中使用dbadapter操作数据库的几种方法(持续更新)
- ant的build.xml文件分析
- web.xml文件的详细分析
- tomcat的server.xml文件分析
- test.jpdl.xml文件的分析
- activebpel下sample2的build.xml文件分析
- 使用dom4j对rss的xml文件分析
- c# 读取xml文件 "分析 EntityName 时出错"的解决方案
- Android中XML文件常用解析方式的比较分析
- SharePoint Log分析 —— 找不到feature的xml文件
- c# 读取xml文件 "分析 EntityName 时出错"的解决方案
- 读取xml文件"分析 EntityName 时出错"的解决方案
- Dubbo包结构分析以及对XML文件的解析
- hibernate.cfg.xml文件元素的具体分析
- ApplicationContext.xml的分析
- 合法的XML文件
- android多线程学习
- 89. Gray Code
- 构建物品系统(课堂笔记)
- 排序总结
- POJ
- dbAdapter的xml文件的分析
- 问题:解决java/后端 设置cookies 中文乱码
- MATLAB学习笔记 函数记录(三)
- rootfs文件系统的制作(二)
- 习惯二 以终为始---自我领导的原则
- Python基础-继承和多态
- Scala简介
- 设计模式开篇-不要滥用设计模式
- nginx 学习笔记(一)nginx 编译安装