Professional Documents
Culture Documents
Lecture #5
Shape:
The shape and colors of buttons can also be
customized. Create a new xml and pick the shape
tag. The shape default is rectangle.
"rectangle"
A rectangle that fills the containing View. This is the default shape.
"oval"
"line"
A horizontal line that spans the width of the containing View. This shape
requires the <stroke> element to define the width of the line.
"ring"
A ring shape.
<gradient>
Creates rounded corners for the shape. Applies only when the shape is a rectangle.
<stroke>
Padding to apply to the containing View element (this pads the position of the View content,
not the shape).
Dialogs:
Dialogs are windows that pop-up on top of the
screen that can show a message to the user or ask
the user to make a decision or enter information.
Default dialog not recommended as a standard.
There are different types:
AlertDialog
DatePickerDialog
TimePickerDialog
Prior to 3.1 dialogs were very easy to implement
but after 3.1, there are a few changes that need to
Basic Animation:
With xmls, simple animation can be created. These animations
are called tweens which means in between, in that they are
simple transitions that when they work together, they create an
animation. To see a simple animation create a folder called
animator inside the res folder. In this animator folder, create a
xml and select the set tag.
If you want the element to stay after the animation is done so it wont reset back to the initial position
use android:fillAfter = true inside the set tag.
Interpolators can also be used to affect the rate of change in an animation. They can be used using the
android :interpolator = add interpolator here inside the set tag.
<objectAnimator>
Animates a specific property of the element, defined by the android:propertyName.
Can be x, y, alpha etc.
valueTo this the the value where the property will end.
Duration the total duration of the animation
Repeatcount defines how many times will the animation occur. A -1 means infinite. 1 means one
time. 0 means no repetition.
Repeatmode - How it will behave at the end of the animation. Restart to start from the beginning. A
reverse will mean that when it ends it will do the animation backwards.