天天看點

【Android Training UI】建立自定義Views(Lesson 0 - 章節概覽)

發表在我的獨立網站http://kesenhoo.github.io/blog/2013/06/30/android-training-ui-creating-custom-views-lesson-0/ ,歡迎通路!

Android的framework有大量的Views用來與使用者進行互動并顯示不同種類的資料。但是有時候你的程式有個特殊的需求,而Android内置的views元件并不能實作。這一章節會示範如何建立你自己的views,并使得它們是robust與reusable的。

Dependencies and Prerequisites

Android 2.1 (API level 7) or higher

YOU should also read

  • Custom Components
  • Input Events
  • Property Animation
  • Hardware Acceleration
  • Accessibility developer guide

Try it out

Download the sample

CustomView.zip

Lesson

(1)建立一個View類

Create a class that acts like a built-in view, with custom attributes and support from the ADT layout editor.

(2)自定義Drawing

Make your view visually distinctive using the Android graphics system.

(3)使得View是可互動的

Users expect a view to react smoothly and naturally to input gestures. This lesson discusses how to use gesture detection, physics, and animation to give your user interface a professional feel.

(4)優化View

No matter how beautiful your UI is, users won’t love it if it doesn’t run at a consistently high frame rate. Learn how to avoid common performance problems, and how to use hardware acceleration to make your custom drawings run faster.

學習自:http://developer.android.com/training/custom-views/index.html,請多指教,謝謝!

轉載請注明出自http://kesenhoo.github.com,謝謝配合!