<uses-permission android:name="android.permission.CALL_PHONE" />//打电话的权限
<uses-permission android:name="android.permission.INTERNET" />//访问网络的权限
<user-permission android:name="android.permission.SEND_SMS"//发送短信的权限
android:screenOrientation="landscape"//横屏显示
android:screenOrientation=“portrait”//竖屏显示
android:configChanges="keyboardHidden|orientation|screenSize"//横竖屏切换时不让activity销毁。此时会调用onConfigChanges()
安卓中生成库文件:
比如像c#中的dll文件,生成库文件步骤:工程-右键选属性-android-勾选 is library
其他工程导入库文件步骤:工程-右键选属性-android-add-选择要导入的库
生成Jar包的方法:文件-导出-Java
让程序启动时创建自己定义的application类对象:
public myApplication extends application(){...}
然后在<application>节点中配置:android:name="包名.myApplication"
要打开其他应用程序的activity,其他应用程序的activity要设置属性:android:exported=true,默认是false
把activity变为透明:android:theme="@android:style/theme.translucent"
关闭activity:finish()
getWindow().getWindowManager().getDefaultDispaly().getHeight()
ANR(application no responding):主界面在无法响应输入事件(超过6s的行为)
长度单位:
px:表示屏幕实际的像素。
dp:是屏幕的物理尺寸,适用于控件
sp:与刻度无关的像素,适用于字体
启动系统中的activity组件:
拨打电话:intent.setAction(intent.ACTION_CALL);//intent.ACTION_DIAG//是打开系统的拨号界面
发送短信:
Uri _url=new Uri.parse("smsto:"+"10086");//要发送的手机号
intent.setData(_url);
intent.setAction(intent.ACTION_SENDTO);
intent.putExtra("string","内容");//发送的短信内容
打开相机:intent.setAction(MediaStore.ACTION_IMAGE_CAPTURE);