安卓第一行代码总结(一)
来源:互联网 发布:ps4串流pc软件 编辑:程序博客网 时间:2024/06/05 23:49
一、对Android的了解
1、Android的系统架构–是基于Linux开发的操作系统。
a、 Linux内核层
b、 系统运行库层
c、 应用框架层
d、应用层
2、关于日志(Log)工具
a、为什么在Android中不用System.out.println()?
原因是于Log相比它在日志打印是不可控制,打印时间无法确定,不能添加过滤器。。。。
b、在写Log的技巧(在输入logt后按Tab键可以可以生成一个常量。)
3、AndroidManifest.xml清单文件的解析:<?xml version="1.0" encoding="utf-8"?><!--该包名用于唯一的该应用--><manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.exa<?xml version="1.0" encoding="utf-8"?><!--该包名用于唯一的该应用--><manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.jcs.myone"> <!--allowBacku指的应用程序是否允许备份--> <!--supportRtl指的是有一个强制使用从右到左的布局方向--> <!--theme指定自己的主题--> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".MainActivity"> <intent-filter> <!--指定该activity是程序的入口--> <action android:name="android.intent.action.MAIN" /> <!--指定加载该应用时运行该Activity--> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application></manifest>mple.jcs.myone"> <!--allowBacku指的应用程序是否允许备份--> <!--supportRtl指的是有一个强制使用从右到左的布局方向--> <!--theme指定自己的主题--> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".MainActivity"> <intent-filter> <!--指定该activity是程序的入口--> <action android:name="android.intent.action.MAIN" /> <!--指定加载该应用时运行该Activity--> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application></manifest>2、当一个界面销毁时把数据返回给上一个页面首页:StartActivityForResult(intent,请求吗);下一个:用setResult(RESULT_OK,intent)首页:重写onActivityResult(请求码,返回传入的结果值(RESULT_OK),intent)Switch判断返回的是哪个请求码在判断传回来的处理结果后获得intent值。3、禁用转化为写的特性:android:textAllCaps="false"4、imageview中改变图片:imageView.setImage Resource(R.mipmap.image);5、进度条:ProgressBar隐藏和显示切换:if (progressBar.getVisibility() == view.GONE) { progressBar.setVisibility(view.VISIBLE);} else { progressBar.setVisibility(view.GONE);}6、获取和设置值:int propess = progressBar.getProgress();propess = propess + 10;progressBar.setProgress(propess);7、设置样式:style="?android:attr/progressBarStyleHorizontal"/8、AlertDialog警告对话框: AlertDialog.Builder dialog = new AlertDialog.Builder(MainActivity.this);dialog.setTitle("Hello");dialog.setMessage("你是傻逼?");dialog.setCancelable(false);//按返回键是否可以撤销(true可以,false不可以)dialog.setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { }});dialog.setNegativeButton("Exit", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { }});dialog.show();9、进度条对话框:ProgressDialog dialog = new ProgressDialog(MainActivity.this);10、LinearLayout: android:layout_width="0dp"android:layout_weight="2"//平分。
阅读全文
0 0
- 安卓第一行代码总结(一)
- (第一行代码)笔记(一)
- 第一行代码复读收获(一)
- 第一行代码学习笔记(一)
- 第一行代码Android学习(一)
- ListView 总结(学习《第一行代码》)
- <第一行代码>笔记一
- 《第一行代码》复习一
- 《第一行代码》读完总结
- 《第一行代码》扩展总结
- 《第一行代码》基础总结
- 《第一行代码(第二版)》的学习(一)
- 《第一行代码-Android》学习笔记(一)
- 第一行代码Android学习笔记(一)activity
- 《第一行代码》第七章 读取系统联系人(一)
- 第一行代码-Android 学习笔记(一)
- 第一行代码酷欧天气开发(一)
- 参照《第一行代码》开发CoolWeather (一)
- 微信退款开发过程
- H5的 WebSocket
- Leetcode 516. Longest Palindromic Subsequence
- 翻译 – 高性能网站需避免的7个错误
- 百亿级日志处理稳定性保证的一些技巧
- 安卓第一行代码总结(一)
- 异构信息网络+推荐===总结
- 5.Worker源码分析
- Android短信备份
- java.lang.NoClassDefFoundError
- ROS教程(三):创建ROS程序包
- C,C++,VC++,MFC之间有什么区别和联系
- 安卓开发入门之自定义柱状图
- 6.job触发流程原理剖析与源码分析