Drawable

Ace your homework & exams now with Quizwiz!

What is 9 patch file extension?

.9.png

When using 9 patch, image should have

1 px white or transparent border

How to create nine patch out of png?

1. Right click on png file 2. Click on Create 9-patch file 3. Name file

2 ways of initialising drawable

1. from bitmap (raster) 2. from xml (vector)

How to draw object on some angle?

1. save canvas location using save() method 2. rotate canvas using rotate(degrees, px, py) 3. draw object 4. return to saved location using restore() method

Drawable also supports

9 patch

What is LevelListDrawable?

Drawable whose state depends on level parameter and it is set using setLevel method. For nested drawable minLevel and maxLevel attributes can be set according to which required drawable is selected

What is ARGB_8888?

Enum config, it contains information about opacity and colors quality. 8 means 8bit for each parameter

How to create Bitmap from scratch?

Bitmap. createBitmap(500,500,Bitmap.Config. ARGB_8888);

Why vector image is more preferred way to show image?

because after scaling image does not lose its quality

How to draw rectangle on canvas?

canvas.drawRect( 0, point2, canvas.getWidth(), height, red);

1 px border is also called

controlling border

1 px border is filled with black color and

it is scaled

What is ShapeDrawable?

main drawable. Represents geometric shape: rectangle, oval, line or ring. Solid color, gradient, corner radius and border width etc can be specified

How to create canvas?

new Canvas(bitmap)

How to create paint?

new Paint(green)

While drawing canvas can be

rotated

Vector image nodes

share for ShapeDrawable clip for ClipDrawable inset for InsetDrawable scale for ScaleDrawable layer-list for LayerDrawable selector for StateListDrawable level-list for LevelListDrawable transition for TransitionDrawable bitmap for BitmapDrawable nine-patch for NinePatchDrawable

How to set color for all pixels?

using eraseColor method

How to get or set bitmap pixel?

using set and getPixel methods

What is vector image?

Xml file which describes image characteristics

What is drawable?

Class that is used to show image

What is canvas?

Class that provides methods to draw on bitmap

How to get drawable from resources?

ContextCompat.getDrawable(context, R.drawable.image)

What is bitmap?

Data structure or byte array. In Android, it is class to work with images

What is ClipDrawable?

It allows to cut nested drawable according to orientation and gravity attributes

What is ScaleDrawable?

It allows to scale nested drawable according to orientation, width scale and height scale attributes

What is InsetDrawable?

It allows to set padding for nested drawable

What is TransitionDrawable?

It contains 2 items. Transition happens using startTransition and reverseTransition methods

What is LayerDrawable?

It contains several nested drawables. Each drawable is contained in item node. The latest nested drawable is drawn on the top

What is StaleListDrawable?

It describes different item states. Each state has its drawable. Example: different states of button

Why canvas is rotated rather than drawing object on some angle?

It is much efficient to rotate canvas

What is BitmapDrawable?

It uses link to bitmap

What is NinePatchDrawable?

It uses link to nine patch file

What is recommended format

PNG

What is 9 patch?

PNG extension which contains information about how image should be scaled and how content should placed

Drawable supports

PNG, JPG, GIF formats

First of all,

Paint should be prepared to set color, style


Related study sets

national practice exam questions

View Set

Texas Real Estate Investment CE 30 Hours

View Set

Lifespan Development Units 1-4, Quiz Questions

View Set

L.I.F.E.P.A.C. high school health (the head and crown of creation)

View Set