android基础--log的处理
来源:互联网 发布:anaconda带python吗 编辑:程序博客网 时间:2024/04/29 23:50
android eclipse 中的组成
src java代码
gen R.java
res
layout main.xml
value string.xml
drawable-hdpi
drawable-ldpi
drawable-mdpi
assets ---> 动画
-------------------------------
android 项目开发的思路
页面(UI)
layout
xml 显示内容
引用 res 包中的内容
字符串 ----> value === string.xml
@string/hello
@drawable/图片的名字
程序 Activity
1 public class My extends Activity{
public void onCreate(Budle b){
super.onCreate();
setContentView(R.layout.main);
}
}
2 AndroidManifest.xml 配置文件(清单文件)
<manifest package=""
android:versionCode="" --- 整数 给开发者看的版本号
versionName="" --- 字符串 给用户看的版本号
<use-sdk android:minSdkVersion=""/>最低支持的版本
<application android:icon="定义项目在系统中的显示图片">
android:label="定义项目在系统中的显示名字"/>
<activity android:name="类名字"
android"label="当前Activity中的标题">
</activity>
</application>
------------------------------------------------
Log 日志
作用: 把程序的运行过程一步一步的输入到控制台
便于程序员检查程序的运行情况,及时的
发现程序的错误
android --- console (日志) 不输出异常
DDMS (完整的日志) 输出异常
思考
eclipse中 android程序 --- 模拟器中
1 启动 模拟器
2 eclipse android项目 --- apk
3 apk --- 上传到 --- 模拟器
4 安装程序
5 run Activity
----------------------------------------------
程序员 android提供程序员输出日志内容
JavaEE
log4j
各司其职
Log.d("xxx"); Debug 调试信息
Log.i("xxx"); Info 输出程序运行的信息
Log.w("xxx"); Warining 输出程序运行中的报警信息
提示程序运行的潜在风险
Log.e("xxx"); Error 输出程序出现错误的信息
注意 日志存在优先级
debug |
info |
warn |
error V
91 android
Log.i("91","xxx");
豌豆夹
Log.i("wd","xxxx");
-------------------------------------------------
android显示控件
显示页面 控件组成
<TextView /> 页面输出文本
如何在Android中使用控件
1 拖拽
UI 拖拽 main.xml
2 编码
3 xml标签
注意: 基本android UI 组件都要设置
layout_width
layout_height
fill_parent 整个Activity宽
wrap_content 根据组件文字自适应
dip单位 定义高度 和 宽度
如果当前编辑XML 那么直接运行可能有错
最好在类的环境中点击run
textColor="#8位16进制树"
# FF FF FF FF
alpha R G B
FF不透明
00透明
textSize="设置文字大小" sp单位
background="设置背景 颜色"
* 图片
id="@+id/xxxx" 唯一
自动在 R 类 创建一个内部类 id 会有相应的值得创建
目的 唯一标示一个UI标签
为 按钮增加监听
1 <Button androd:id="@+id/myButton"/>
R.id.myButton
2 Button b = (Button)findViewById(R.id.myButton);
3 b.setOnClickListener(new OnClickListener(){
onClick(View v){
xxxx
}
});
问题
1 FC框 程序中断 Logcat 日志 异常
2 Logcat日志 如果多个项目中的包名和类名一致
错误导航不准确
EditText 可以编辑文本框
问题
1 图片 png
2 命名 小写字母 0--9 . _
- android基础--log的处理
- android log处理
- Xcode8 Log 的处理
- Android常用工具类之Log的特别处理
- Android的Log图文详解(Log.v,Log.d,Log.i,Log.w,Log.e)!
- Android的Log图文详解(Log.v,Log.d,Log.i,Log.w,Log.e)
- Android的Log图文详解(Log.v,Log.d,Log.i,Log.w,Log.e)
- Android的Log图文详解(Log.v,Log.d,Log.i,Log.w,Log.e)!
- Android的Log图文详解(Log.v,Log.d,Log.i,Log.w,Log.e)
- android的Log详解(Log.v Log.d Log.i Log.w Log.e)
- 关于LOG日志的处理
- android的Log输出
- android的log
- android的crash log
- Android的Log系统
- 抓android的log
- android的crash log
- android Log 的分析
- vb.net与c#相互转换工具
- Linux 魔术键
- Java集合框架的知识总结
- WP7关于ContextMenu响应范围的问题
- android googlemap权限问题
- android基础--log的处理
- growcut分割方法的mex代码
- android googlemap的location报空指针解决案例
- 【杂乱的生活】50条经典心理定律,教你看透人心!
- android基础--activity的使用
- 从先序中序重建二叉树输出层序后序
- C++泛型
- android基础--activity基础
- Matlab7 runtime error 解决方案集合