- 以下是其他Android知识点总结:
BaseActivity中有跳转至SettingActivity【"hongri://recyclerview:6666/setting?id=99&name=jack"】的页面唤端(模仿APP唤端,原理一致),有写到几种唤端方式。
####(1)设置启动Activity的launchMode:singleTop ---> standard(或singleTop).并且在启动页跳转MainActivity时finish掉即可(或设置启动页android:noHistory="true"--类似于finish)。
if (!this.isTaskRoot()) {
Intent intent = getIntent();
if (intent != null) {
String action = intent.getAction();
if (intent.hasCategory(Intent.CATEGORY_LAUNCHER) && Intent.ACTION_MAIN.equals(action)) {
finish();
return;
}
}
}
<style name="TestTheme" parent="android:Theme.Material.NoActionBar">
<!--下列两行控制使得应用窗口透明,用于展示一些差异-->
<item name="android:windowBackground">@color/transparent</item>
<item name="android:windowIsTranslucent">true</item>
<!--设置导航栏/状态栏窗口color为透明【app布局不会延伸到导航栏/状态栏】-->
<!--<item name="android:statusBarColor">@android:color/transparent</item>-->
<!--<item name="android:navigationBarColor">@android:color/transparent</item>-->
<!--与color transparent的区别【app布局将会延伸到导航栏/状态栏】-->
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
</style>
//使得布局延伸到状态栏和导航栏区域
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
//透明状态栏/导航栏
window.setStatusBarColor(Color.TRANSPARENT);
window.setNavigationBarColor(Color.TRANSPARENT);
在布局中设置:
android:fitsSystemWindows="true"
可以使得,系统自动为视图添加一个状态栏/导航栏高度的padding
指令举例:adb shell am start -n com.hongri.recyclerview/com.hongri.recyclerview.activity.SettingActivity --es name zhongyao --ei age 18
Android审核:用户授权前获取mac地址,imei等用户敏感信息的方法
'''
android:allowEmbedded=["true" | "false"]
【一般为开发可穿戴设备时使用】
android:allowTaskReparenting=["true" | "false"]
【这个标示和 Application 的标识意义一样,所以如果同时声明该标识,这个标识会覆盖 Application 的标识】
android:alwaysRetainTaskState=["true" | "false"]
【这个标识用来指示系统是否始终保持 Activity 所在任务的状态。该属性只对任务的根 Activity 有意义】
android:autoRemoveFromRecents=["true" | "false"]
android:banner="drawable resource"
【和 application 里面的 banner 标识一样,用在 android TV 上】
android:clearTaskOnLaunch=["true" | "false"]
【当应用从主屏幕重新启动时是否都从中移除除根 Activity 之外的所有 Activity。该属性只对任务的根 Activity 有意义】
android:colorMode=[ "hdr" | "wideColorGamut"]
【广色域】
android:configChanges=["mcc", "mnc", "locale",
"touchscreen", "keyboard", "keyboardHidden",
"navigation", "screenLayout", "fontScale",
"uiMode", "orientation", "density",
"screenSize", "smallestScreenSize"]
【列出 Activity 将自行处理的配置更改消息】
android:directBootAware=["true" | "false"]
【】
android:documentLaunchMode=["intoExisting" | "always" |
"none" | "never"]
android:enabled=["true" | "false"]
【该属性用来标示系统是否可将 Activity 实例化】
android:excludeFromRecents=["true" | "false"]
【是否应将该 Activity 启动的任务排除在最近使用的应用列表(即概览屏幕)之外】
android:exported=["true" | "false"]
【指明Activity 是否可由其他应用的组件启动】
android:finishOnTaskLaunch=["true" | "false"]
【标示每当用户再次启动其任务(在主屏幕上选择任务)时,是否应关闭(完成)现有 Activity 实例 】
android:hardwareAccelerated=["true" | "false"]
【是否应为此 Activity 启用硬件加速渲染】
android:icon="drawable resource"
【一个表示 Activity 的图标。该图标会在需要在屏幕上表示 Activity 时显示给用户。】
android:immersive=["true" | "false"]
android:label="string resource"
【一种可由用户读取的 Activity 标签。该标签会在必须将 Activity 呈现给用户时显示在屏幕上】
android:launchMode=["standard" | "singleTop" |
"singleTask" | "singleInstance"]
android:lockTaskMode=["normal" | "never" |
"if_whitelisted" | "always"]
android:maxRecents="integer"
【该标识用来指明概览屏幕中位于此 Activity 根位置的任务数上限。 达到该条目数时,系统会从概览屏幕中移除最近最少使用的实例。】
android:maxAspectRatio="float"
android:multiprocess=["true" | "false"]
【该标识用来指明是否可以将 Activity 实例启动到启动该实例的组件进程内】
android:name="string"
android:noHistory=["true" | "false"]
【当用户离开 Activity 并且其在屏幕上不再可见时,是否应从 Activity 堆栈中将其移除并完成。如果为true,系统永远不会调用 onActivityResult()】
android:parentActivityName="string"
【Activity 逻辑父项的类名称。】
android:persistableMode=["persistRootOnly" |
"persistAcrossReboots" | "persistNever"]
android:permission="string"
android:process="string"
【应在其中运行 Activity 的进程的名称】
android:relinquishTaskIdentity=["true" | "false"]
android:resizeableActivity=["true" | "false"]
【代表这个 activity 是否支持分屏模式。】
android:screenOrientation=["unspecified" | "behind" |
"landscape" | "portrait" |
"reverseLandscape" | "reversePortrait" |
"sensorLandscape" | "sensorPortrait" |
"userLandscape" | "userPortrait" |
"sensor" | "fullSensor" | "nosensor" |
"user" | "fullUser" | "locked"]
android:showForAllUsers=["true" | "false"]
android:stateNotNeeded=["true" | "false"]
【能否在不保存 Activity 状态的情况下将其终止并成功重新启动】
android:supportsPictureInPicture=["true" | "false"]
【指定 Activity 是否支持画中画显示,设置该属性的同时,需要将 android:resizeableActivity 标识设置为 true】
android:taskAffinity="string"[TODO 对此属性尚有疑惑]
【任务相关性---这个参数标识了一个Activity所需要的任务栈的名字,taskAffinity属性主要和singleTask启动模式或者allowTaskReparenting属性配对使用,在其他情况下没有意义
1、当taskAffinity和singleTask启动模式配对使用的时候,它是具有该模式的Activity的目前任务栈的名字,待启动的Activity会运行在名字和taskAffinity相同的任务栈中。
2、当taskAffinity和allowTaskReparenting结合的时候,会产生特殊的效果。如当一个应用A启动了一个应用B中的某个Activity后,如果这个Activity的allowTaskReparenting属性为true的话,
那么当应用B被启动后,此Activity会直接从应用A的任务栈转移到应用B的任务栈中。】
android:theme="resource or theme"
android:uiOptions=["none" | "splitActionBarWhenNarrow"]
【主要是用来针对 action bar 的】
android:windowSoftInputMode=["stateUnspecified",
"stateUnchanged", "stateHidden",
"stateAlwaysHidden", "stateVisible",
"stateAlwaysVisible", "adjustUnspecified",
"adjustResize", "adjustPan"]
【这个标识用来设置 Activity 的主窗口与包含屏幕软键盘的窗口的交互方式】