Skip to content

hoverchat/drawable-utils-android

Repository files navigation

drawable-utils-android

Easy to use state Drawable(s).

Usage

    // Source state bitmaps.
    StateBitmap normalStateBitmap = new StateBitmap.Builder()
            .setStates(new StateBitmap.State[]{})
            .setBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.ic_button_bitmap_normal))
            .build();
    StateBitmap pressedStateBitmap = new StateBitmap.Builder()
            .setStates(new StateBitmap.State[]{StateBitmap.State.Pressed})
            .setBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.ic_button_bitmap_pressed))
            .build();
    
    Drawable srcDrawable  = new StateListDrawableBuilder(getResources())
            .addStateBitmap(normalStateBitmap)
            .addStateBitmap(pressedStateBitmap)
            .build();
    
    mImageButton.setImageDrawable(srcDrawable);

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages