IT. Expert System.

Android Reference


Class LevelListDrawable

  • All Implemented Interfaces:

    public class LevelListDrawable
    extends DrawableContainer
    A resource that manages a number of alternate Drawables, each assigned a maximum numerical value. Setting the level value of the object with Drawable.setLevel(int) will load the image with the next greater or equal value assigned to its max attribute. A good example use of a LevelListDrawable would be a battery level indicator icon, with different images to indicate the current battery level.

    It can be defined in an XML file with the <level-list> element. Each Drawable level is defined in a nested <item>. For example:

     <level-list xmlns:android="">
      <item android:maxLevel="0" android:drawable="@drawable/ic_wifi_signal_1" />
      <item android:maxLevel="1" android:drawable="@drawable/ic_wifi_signal_2" />
      <item android:maxLevel="2" android:drawable="@drawable/ic_wifi_signal_3" />
      <item android:maxLevel="3" android:drawable="@drawable/ic_wifi_signal_4" />

    With this XML saved into the res/drawable/ folder of the project, it can be referenced as the drawable for an ImageView. The default image is the first in the list. It can then be changed to one of the other levels with ImageView.setImageLevel(int). For more information, see the guide to Drawable Resources.

    • Constructor Detail

      • LevelListDrawable

        public LevelListDrawable()
    • Method Detail

      • addLevel

        public void addLevel(int low,
                    int high,
                    Drawable drawable)
      • onLevelChange

        protected boolean onLevelChange(int level)
        Description copied from class: Drawable
        Override this in your subclass to change appearance if you vary based on level.
        onLevelChange in class DrawableContainer
        Returns true if the level change has caused the appearance of the Drawable to change (that is, it needs to be drawn), else false if it looks the same and there is no need to redraw it since its last level.
      • mutate

        public Drawable mutate()
        Description copied from class: Drawable
        Make this drawable mutable. This operation cannot be reversed. A mutable drawable is guaranteed to not share its state with any other drawable. This is especially useful when you need to modify properties of drawables loaded from resources. By default, all drawables instances loaded from the same resource share a common state; if you modify the state of one instance, all the other instances will receive the same modification. Calling this method on a mutable Drawable will have no effect.
        mutate in class DrawableContainer
        This drawable.
        See Also:
        Drawable.ConstantState, Drawable.getConstantState()


Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)





Java Script








Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 172 / 159283919. Delta: 0.05037 с