setCompoundDrawables(left, top, right, bottom);
setCompoundDrawablesWithIntrinsicBounds(left, top, right, bottom)
意思是設置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有被點擊的效果,但是不執行點擊事件。