1.通过隐匿意图启动桌面
Intent launcherIntent = new Intent(Intent.ACTION_MAIN);
launcherIntent.addCategory(Intent.CATEGORY_HOME);
startActivity(launcherIntent);
2.Android Studio通过AIDL传递复杂数据时,报告符号找不到:
Error:(10, 50) 错误: 找不到符号
符号: 类 CloudPhoto
位置: 程序包 com.toycloud.alphaegg.album.albumInterface
原因是新的类型在AIDL目录中定义,android studio默认没有在相应目录中查找Java源代码。解决方法是修改项目的build.gradle
android { sourceSets { main {
res.srcDirs = ['src/main/res', 'src/main/res/layout-1920x1080']
java.srcDirs = ['src/main/java','src/main/aidl']
} } }
3.Activity中任意点击导致导航栏弹出
<item name="android:windowNoTitle">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowFullscreen">true</item>
通过增加windowFullscreen有可能能够解决此问题,这个标志可以帮助保证窗口全屏显示。
4.Fragment按键穿透和控件穿透问题
通过在Fragment的根View拦截Touch事件能够解决按键穿透的问题。
通过把布局文件嵌入到include中似乎也能治愈控件穿透问题。
下面的布局中fl_camera_preview_container布局展开后会把自身设置为全透明,这个可能是导致控件穿透的问题之一。
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<include
android:id="@+id/sub_layout_main_menu"
layout="@layout/sub_layout_main_activity_main" />
<FrameLayout
android:id="@+id/fl_camera_preview_container"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</FrameLayout>
5.系统的Fragment 和支持包v4的Fragment二者传递对象不兼容
import Android.app.Fragment;和import android.support.v4.app.Fragment; 两种Fragment的实现不一样,二者传递对象不兼容。
使用ViewPager时,需要使用FragmentStatePagerAdapter,FragmentStatePagerAdapter的方法实现过程中,遇到“两种Fragment的实现不一样,二者传递对象不兼容”问题;
导入android.support.v13.app.FragmentStatePagerAdapter;而不是android.support.v4.app.FragmentStatePagerAdapter;即可解决。
6.获得system目录可写权限
mount -o remount rw /system
7.常用adb命令
通过关键字搜索包名 adb shell pm list packages | findstr "launcher"
查看servicecs使用细节 adb shell dumpsys activity services
查看activity使用细节 adb shell dumpsys activity
显示状态栏相关的信息 adb shell dumpsys statusbar
使用程序的包名或者进程id显示内存信息 adb shell dumpsys meminfo $package_name or $pid
找出状态栏通知的包名 adb shell dumpsys statusbar | grep notification=Notification
列出安卓系统中所有输入设备 adb shell cat /proc/bus/input/devices