Last active
December 17, 2015 12:49
-
-
Save dzwillpower/5612497 to your computer and use it in GitHub Desktop.
Android 常用代码片段 Android common in use code snippet #常用代码片段
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | |
<item android:color="#53c1bd" android:state_selected="true"/> | |
<item android:color="#53c1bd" android:state_focused="true"/> | |
<item android:color="#53c1bd" android:state_pressed="true"/> | |
<item android:color="#777777"/> | |
</selector> | |
/** | |
文字根据状态更改颜色 放在res/color/目录下 android:textColor*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
背景色根据状态更改颜色 android:backgroup | |
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | |
<item android:state_selected="true"><shape> <gradient android:angle="0" android:centerColor="#00a59f" android:endColor="#00a59f" android:startColor="#00a59f" /> | |
</shape></item> | |
<item android:state_focused="true"><shape> | |
<gradient android:angle="0" android:centerColor="#00a59f" android:endColor="#00a59f" android:startColor="#00a59f" /> | |
</shape></item> | |
<item android:state_pressed="true"><shape> | |
<gradient android:angle="0" android:centerColor="#00a59f" android:endColor="#00a59f" android:startColor="#00a59f" /> | |
</shape></item> | |
<item><shape> | |
<gradient android:angle="0" android:centerColor="#00ff00" android:endColor="00ff00" android:startColor="00ff00" /> | |
</shape></item> | |
</selector> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PackageManager pm = getPackageManager(); | |
for (ApplicationInfo app : pm.getInstalledApplications(0)) { | |
Log.d("PackageList", "package: " + app.packageName + ", sourceDir: " + app.sourceDir); | |
} | |
输出如下: | |
package: com.tmobile.thememanager, sourceDir: /system/app/ThemeManager.apk | |
package: com.touchtype.swiftkey, sourceDir: /data/app/com.touchtype.swiftkey-1.apk |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment