The android:src attribute gives the location where this image is stored.In the above example the height and width are set to wrap_content, which means the View is only big enough to enclose the image within it, plus padding. The android:layout_width and android:layout_height attributes specify the size of the View. The android:id attribute sets a shortcut name that you use to call the image later.For example, this ImageView displays an image called "birthdaycake.png": In the element in your XML file, define how the Drawable is displayed and where the Drawable file is located. To display a Drawable, use the ImageView class to create a View. You retrieve a Drawable using APIs such as getDrawable(int), and you apply a Drawable to an XML resource using attributes such as android:drawable and android:icon.Īndroid includes several types of drawables, most of which are covered in this chapter. You also learn how to use styles and themes to provide a consistent appearance to all the elements in your app while reducing the amount of code.Ī Drawable is a graphic that can be drawn to the screen. Android provides classes and resources to help you include rich images in your application with a minimal impact to your app's performance. In this chapter you learn how to use drawables, which are compiled images that you can use in your app. Lesson 3: Testing, debugging, and using support libraries
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |