726學習

手工設置文本與圖片相對位置時,常用到如下方法:
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的長寬。
而setCompoundDrawablesWithIntrinsicBounds是畫的drawable的寬高是按drawable固定的寬高,即通過getIntrinsicWidth()與getIntrinsicHeight()獲得,所以纔有The Drawables' bounds will be set to their intrinsic bounds.這句話之說!

 

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)

LayoutAnimationController
      LayoutAnimationController用於爲一個Layout裏面的控件或者是Viewgroup的控件設置動畫效果。。
LayoutAnimationController 用來爲一個layout 或是viewgroup 包含的子view添加動畫效果, Layout中的每個元素
都會採用同一個動畫效果,但開始時間不同。 子View動畫的缺省開始時間爲子View在Layout中的序號index 乘以 一個固定的時間間隔。 
LayoutAnimationController 的子類可以重載getDelayForView(android.view.View)爲子View定義動畫開始時間,
如GridLayoutAnimationController 根據子View的行和列來計算子View動畫的開始時間。
順序::
ORDER_NORMAL
ORDER_REVERSE
ORDER_RANDOM
====================
AnimationSet
Represents a group of Animations that should be played together.
 * The transformation of each individual animation are composed 
 * together into a single transform. 
 在Android 中用於製作混合型動畫
 AnimationSet 可以包含多個Animation,但都是在同一個時間執行的,是並行,不是串行執行的。
如果AnimationSet中有一些設定,如duration,fillBefore等,它包含的子動作也設定了的,
 

====================
 
 Interpolator
定義了動畫變化的速率或規律,其具體的實現可以使用以下子類:
 interpolator 被用來修飾動畫效果,定義動畫的變化率,
  可以使存在的動畫效果可以 accelerated(加速),decelerated(減速),repeated(重複),bounced(彈跳)等
 
 
 =========================
 
android:layoutAnimation 屬性定義在ViewGroup中,因此所有ViewGroup的子類都可以定義android:layoutAnimation。 ViewGroup可以嵌套定義,從而layout animation 也可以嵌套


Animation使用方法 http://cache.baidu.com/c?m=9f65cb4a8c8507ed4fece76310508d315909dc743ca0804b22818448e4635810013bf4bb50734d5bcec57d6d00a5495bf7f43176330822a3de95c81cd2e5c13f2ef86c69375ad51d498c4ae9901b79d621e00bb4f35fa7e7ae6cc4ee&p=882a9642d7d252f511be9b7d0b088029&user=baidu&fm=sc&query=LayoutAnimationController&qid=84c4c6c21b74ee07&p1=12


android:duplicateParentState

如果設置此屬性,將直接從父容器中獲取繪圖狀態(光標,按下等)。 注意僅僅是獲取繪圖狀態,而沒有獲取事件,也就是你點一下LinearLayout時Button有被點擊的效果,但是不執行點擊事件。



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章