0
Androidmobilių programėlių kūrimo įvadas
Drawable ResourcesA drawable resource is a general concept for a graphic that can be drawn to the screen andwhich you can ...
Bitmap         A bitmap image. Android supports bitmap files in a three         formats:         - .png (preferred)       ...
XML Bitmap             An XML bitmap is a resource defined in XML             that points to a bitmap file. The effect is ...
Nine-Patch File                  A NinePatchDrawable graphic is a stretchable                  bitmap image, which Android...
XML Nine-Patch                 An XML Nine-Patch is a resource defined in                 XML that points to a Nine-Patch ...
Layer List             A LayerDrawable is a drawable object that             manages an array of other drawables. Each    ...
State List             A StateListDrawable is a drawable object             defined in XML that uses a several different  ...
State List             Note: Remember that Android applies the first             item in the state list that matches the c...
Transition Drawable                      A TransitionDrawable is a drawable object that                      can cross-fad...
Clip Drawable                A drawable defined in XML that clips another                drawable based on this Drawables ...
Shape DrawableThis is a generic shape defined in XML.Common use - a Drawable with a color gradient for buttons, background...
Shape Drawable
Support LibraryThe support library for v4 provides access to several classes introduced with Android 3.0 andbeyond, plus s...
Fragments
Fragments            To manage your fragments and            loaders, you must use the            methods            Fragm...
Fragments            Implementation of PagerAdapter that uses a            Fragment to manage each page. This class       ...
Fragments
AdaptersAdapters are used to provide the data to the ListViewobject. The adapter also defines how each row is theListView ...
Adapters
Async Task
RecognitionListener                      Used for receiving notifications                      from the SpeechRecognizer w...
RecognitionListener
Q&Av.valkaitis@appcamp.lt
Upcoming SlideShare
Loading in...5
×

"Android" mobilių programėlių kūrimo įvadas #4

381

Published on

Ketvirtoji Android mobilių programėlių kūrimo paskaitą

Published in: Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
381
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of ""Android" mobilių programėlių kūrimo įvadas #4"

  1. 1. Androidmobilių programėlių kūrimo įvadas
  2. 2. Drawable ResourcesA drawable resource is a general concept for a graphic that can be drawn to the screen andwhich you can retrieve with APIs such as getDrawable(int) or apply to another XML resource withattributes such as android:drawable and android:icon.Bitmap File - A bitmap graphic file (.png, .jpg, or .gif). State List - An XML file that references differentCreates a BitmapDrawable. bitmap graphics for different states (for example, to use a different image when a button is pressed).Nine-Patch File - A PNG file with stretchable regions to Creates a StateListDrawable.allow image resizing based on content (.9.png).Creates a NinePatchDrawable. Shape Drawable - An XML file that defines a geometric shape, including colors and gradients.Animation Resource - An animation defined in XML Creates a ShapeDrawable.that modifies properties of the target object, such asbackground color or alpha value, over a set amount of Transition Drawable - An XML file that defines atime. drawable that can cross-fade between two drawable resources. Creates a TransitionDrawable.
  3. 3. Bitmap A bitmap image. Android supports bitmap files in a three formats: - .png (preferred) - .jpg (acceptable) - .gif (discouraged). Note: Bitmap files may be automatically optimized with lossless image compression by the aapt tool during the build process. For example, a true-color PNG that does not require more than 256 colors may be converted to an 8-bit PNG with a color palette.
  4. 4. XML Bitmap An XML bitmap is a resource defined in XML that points to a bitmap file. The effect is an alias for a raw bitmap file. The XML can specify additional properties for the bitmap such as dithering and tiling. Note: You can use a <bitmap> element as a child of an <item> element. For example, when creating a state list or layer list, you can exclude the android:drawable attribute from an <item> element and nest a <bitmap> inside it that defines the drawable item.
  5. 5. Nine-Patch File A NinePatchDrawable graphic is a stretchable bitmap image, which Android will automatically resize to accommodate the contents of the View in which you have placed it as the background. An example use of a NinePatch is the backgrounds used by standard Android buttons — buttons must stretch to accommodate strings of various lengths. A NinePatch drawable is a standard PNG image that includes an extra 1-pixel-wide border. It must be saved with the extension .9.png, and saved into the res/drawable/ directory of your project.
  6. 6. XML Nine-Patch An XML Nine-Patch is a resource defined in XML that points to a Nine-Patch file. The XML can specify dithering for the image.
  7. 7. Layer List A LayerDrawable is a drawable object that manages an array of other drawables. Each drawable in the list is drawn in the order of the list—the last drawable in the list is drawn on top. Each drawable is represented by an <item> element inside a single <layer-list> element.
  8. 8. State List A StateListDrawable is a drawable object defined in XML that uses a several different images to represent the same graphic, depending on the state of the object. For example, a Button widget can exist in one of several different states (pressed, focused, or niether) and, using a state list drawable, you can provide a different background image for each state.
  9. 9. State List Note: Remember that Android applies the first item in the state list that matches the current state of the object. So, if the first item in the list contains none of the state attributes above, then it is applied every time, which is why your default value should always be last (as demonstrated in the following example).
  10. 10. Transition Drawable A TransitionDrawable is a drawable object that can cross-fade between the two drawable resources. Each drawable is represented by an <item> element inside a single <transition> element. No more than two items are supported. To transition forward, call startTransition(). To transition backward, call reverseTransition().
  11. 11. Clip Drawable A drawable defined in XML that clips another drawable based on this Drawables current level. You can control how much the child drawable gets clipped in width and height based on the level, as well as a gravity to control where it is placed in its overall container. Most often used to implement things like progress bars.
  12. 12. Shape DrawableThis is a generic shape defined in XML.Common use - a Drawable with a color gradient for buttons, backgrounds, etc.
  13. 13. Shape Drawable
  14. 14. Support LibraryThe support library for v4 provides access to several classes introduced with Android 3.0 andbeyond, plus some updated version of existing classes, and even some APIs that currently dontexist in the Android platform. Some of the most useful and notable classes that havecounterparts in the v4 support library are:- Fragment- FragmentManager- FragmentTransaction- ListFragment- DialogFragment- LoaderManager- Loader- AsyncTaskLoader- CursorLoader
  15. 15. Fragments
  16. 16. Fragments To manage your fragments and loaders, you must use the methods FragmentActivity.getSupportFrag mentManager() and FragmentActivity.getSupportLoad erManager() (instead of the getFragmentManager() and getLoaderManager() methods).
  17. 17. Fragments Implementation of PagerAdapter that uses a Fragment to manage each page. This class also handles saving and restoring of fragments state. This version of the pager is more useful when there are a large number of pages, working more like a list view. When pages are not visible to the user, their entire fragment may be destroyed, only keeping the saved state of that fragment. This allows the pager to hold on to much less memory associated with each visited page as compared to FragmentPagerAdapter at the cost of potentially more overhead when switching between pages.
  18. 18. Fragments
  19. 19. AdaptersAdapters are used to provide the data to the ListViewobject. The adapter also defines how each row is theListView is displayed.The adapter is assigned to the ListView via thesetAdapter method on the ListView object.An adapter extend the BaseAdapter class. Androidprovides some standard adapters; the most importantare ArrayAdapter and CursorAdapter.ArrayAdapter can handle data based on Arrays orjava.util.List.SimpleCursorAdapter can handle database relateddata. This description focuses on the non databasecase.
  20. 20. Adapters
  21. 21. Async Task
  22. 22. RecognitionListener Used for receiving notifications from the SpeechRecognizer when the recognition related events occur. All the callbacks are executed on the Application main thread.
  23. 23. RecognitionListener
  24. 24. Q&Av.valkaitis@appcamp.lt
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×