安卓第一行代码总结(一)
16lz
2021-01-24
一、对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"> <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> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> intent-filter> activity> application>manifest>mple.jcs.myone"> <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> <action android:name="android.intent.action.MAIN" /> <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"//平分。
更多相关文章
- Android(安卓)应用程序窗体显示状态操作(requestWindowFeature()
- Android(安卓)API中文(1) -- Android是什么 及Android架构
- 3.系统运行库
- Google提供更好的Android应用程序翻译服务
- Android中Service概述
- 【移动开发】Android中WIFI开发总结(二)
- Android(安卓)Q 不叫 Q,正式命名为 Android(安卓)10
- 通过JNI实现c/c++和Android的java层函数互调
- Android应用程序换肤实现系列(四)