千峰Android_Day02
来源:互联网 发布:单片机两个舵机正反转 编辑:程序博客网 时间:2024/06/02 01:09
2016年1月18日(千峰实训第二天)
控件篇:
按钮:
<Button android:id="@+id/btn" android:layout_width="60dp" android:layout_height="40dp" android:layout_alignParentRight="true" android:layout_below="@+id/img" android:text="赞" android:textSize="20sp" android:layout_marginRight="20dp" />
图片:
<ImageView android:contentDescription="@string/app_name" android:id="@+id/img" android:layout_width="500dp" android:layout_height="200dp" android:scaleType="fitXY" android:src="@drawable/a1" android:layout_toRightOf="@+id/icon" android:layout_below="@+id/emotion" android:layout_marginRight="20dp" />
文本:
<TextView android:id="@+id/emotion" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦" android:layout_toRightOf="@+id/icon" android:layout_below="@+id/name" android:layout_marginRight="20dp" />
可编辑文本:
<TextView android:id="@+id/emotion" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦哦" android:layout_toRightOf="@+id/icon" android:layout_below="@+id/name" android:layout_marginRight="20dp" />
String str = edit_count.getText().toString().trim();
//获得可编辑文本内容
Toast.makeText(MainActivity.this, str, Toast.LENGTH_LONG).show();
// 在虚拟机打印,相当于syso
anim_rorate = AnimationUtils.loadAnimation(MainActivity.this, R.anim.rotate); // 初始化可执行性动作
img.startAnimation(anim_shake);// 开始执行
setonclicklistener // 设置事件监听
findviewbyid // 赋内存 关联layout中id
//线式布局 orientation //设置水平 竖直
SRC 导入图片
hint //提示语
textsize// 设置字体大小 单位sp
centerHorizontal//水平居中
marginleft //距离左边距离 right右 top上 bottom 下
layout_torightof //在XX右 above 上 below 下
alignparentleft //在左边 top 上 below下
1)fill_parent
设置一个构件的布局为fill_parent将强制性地使构件扩展,以填充布局单元内尽可能多的空间
2) wrap_content
设置一个视图的尺寸为wrap_content将强制性地使视图扩展以显示全部内容
3)match_parent
Android2.2中match_parent和fill_parent是一个意思 .两个参数意思一样,match_parent更贴切
未完待续。
- 千峰Android_Day02
- android_day02
- 千峰Android_Day03
- 在千峰的学习--Android第一阶段
- 个人千峰前端10天学习
- 2016/7/11千峰培训android第一天
- 千纸鹤
- 千纸鹤
- 千佛山
- 千百度
- 千牛
- 千佛山
- 千百度
- 千古刹
- 【幻化万千戏红尘】千峰培训Day01-java基础学习:历史、数据类型
- 大三夏季学期实训-千峰-css-float属性小记
- 【备忘】2017年最新千峰python零基础入门视频教程下载
- 流传千古曲一折
- javascript性能优化之局部变量的使用
- SDP会话描述协议中的参数整理
- 格式化文件/控制台输入输出
- 算法导论-主定理的严谨证明(1)
- perl-制作统计图(折线)
- 千峰Android_Day02
- gif 格式图片详细解析
- 将nutch2.3的bin/crawl脚本改写为java类
- 2014百度【软件研发】校招一面面经
- android基础学习006_android AsyncTask 和 Handler 介绍
- clipse 自动发布的class 文件怎么在 build 文件夹里面
- 【HTML打卡】0119css 文字、图片、控制器、引入方式、初始化
- 3996: [TJOI2015]线性代数 思路题 最小割(最大权闭合图)
- spark 1.6 MLlib