graphics
graphics
Department of MCA
Deals with
Screen size
Screen resolution
Screen orientation
Colors
Typography
Image formats
android.graphics
android.graphics.drawable
<EditText
android:id=“@+id/edit_text01”
android:background=“@drawable/shape_draw”
android:layout_height=“wrap_content”
android:layout_width=“fill_parent”
android:text=“Shape Drawable”
/>
Main_Activity.xml in the res\drawable folder
2-Dec-23 Building Blocks of Mobile Apps-II/ 19CA701-Mobile Application Development/Haripriya R/MCA/SNSCT 8
Canvas
Set of 2D-DRAWING APIs allows to provide own custom graphics onto a canvas or to
modify existing views to customize their look and feel
There are two ways to draw 2D graphics
1. Draw your animation into a View object from your layout.
2. Draw your animation directly to a Canvas
Some of the important methods of Canvas Class are as follows
drawText()
drawRoundRect() Drawing an animation with a Canvas is
better option when your application
drawCircle() needs to re-draw itself regularly
drawRect()
drawBitmap() Drawing an animation with a View is the
best option to draw simple graphics that
drawARGB() do not need to change dynamically
Animation is the process of adding a motion effect to any view, image, or text.
with the help of an animation, you can add motion or can change the shape of a
specific view
Animation in Android is generally used to give your UI a rich look and feel
The animations are basically of three types as follows:
Property Animation
View Animation
Drawable Animation
Non-linear animation
it can be added as the background image to a View and then called to play
AnimationDrawable rocketAnimation;
rocketImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
rocketAnimation.start();
}
});
}