setCompoundDrawables(left, top, right, bottom);
setCompoundDrawablesWith
意思是设置Drawable显示在text的左、上、右、下位置。
(Textview、Button都可以)
但是两者有些区别:
setCompoundDrawables 画的drawable的宽高是按drawable.setBound()设置的宽高,所以才有The Drawables must already have had setBounds(Rect) called.意思是说使用之前必须使用Drawable.setBounds设置Drawable的长宽。 |
final PackageManager manager = getPackageManager();
final ActivityManager tasksManager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
final List<ActivityManager.RecentTaskInfo> recentTasks = tasksManager .getRecentTasks(MAX_RECENT_TASKS, 0);
获取近期的任务
final Intent pickWallpaper = new Intent(Intent.ACTION_SET_WALLPAPER);
startActivity(Intent.createChooser(pickWallpaper,getString(R.string.menu_wallpaper)));
选择背景图
PackageManager manager = getPackageManager();
Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
final List<ResolveInfo> apps = manager.queryIntentActivities(mainIntent, 0);
Collections.sort(apps, new ResolveInfo.DisplayNameComparator(manager));
获取全部应用程序
checkbox.toggle()
LayoutAnimationController mShowLayoutAnimation = AnimationUtils.loadLayoutAnimation(this,R.anim.show_applications)
定义了动画变化的速率或规律,其具体的实现可以使用以下子类:
Animation使用方法 http://cache.baidu.com/c?m=9f65cb4a8c8507ed4fece76310508d315909dc743ca0804b22818448e4635810013bf4bb50734d5bcec57d6d00a5495bf7f43176330822a3de95c81cd2e5c13f2ef86c69375ad51d498c4ae9901b79d621e00bb4f35fa7e7ae6cc4ee&p=882a9642d7d252f511be9b7d0b088029&user=baidu&fm=sc&query=LayoutAnimationController&qid=84c4c6c21b74ee07&p1=12
android:duplicateParentState
如果设置此属性,将直接从父容器中获取绘图状态(光标,按下等)。 注意仅仅是获取绘图状态,而没有获取事件,也就是你点一下LinearLayout时Button有被点击的效果,但是不执行点击事件。