'old/XML Attr'에 해당되는 글 3건

  1. 2010.02.22 XML Attributes_Animation
  2. 2010.02.22 XML Attributes_TextView
  3. 2010.02.22 XML Attributes_LinearLayout

Animation

Tweened Animation

Android can perform simple animation on a graphic, or a series of graphics. These include rotations, fading, moving, and stretching.

Source file format: XML file, one resource per file, one root tag with no <?xml> declaration

Resource file location: res/anim/some_file.xml

Compiled resource datatype: Resource pointer to an Animation.

Resource reference name:

  • Java: R.anim.some_file
  • XML: @[package:]anim/some_file

Syntax

The file must have a single root element: this will be either a single <alpha>, <scale>, <translate>, <rotate>, interpolator element, or <set> element that holds groups of these elements (which may include another <set>). By default, all elements are applied simultaneously. To have them occur sequentially, you must specify the startOffset attribute.



Elements and Attributes

<set>
A container that can recursively hold itself or other animations. Represents an AnimationSet. You can include as many child elements of the same or different types as you like. Supports the following attribute:

  • shareInterpolator - Whether to share the same Interpolator among all immediate child elements.

<alpha>
A fading animation. Represents an AlphaAnimation. Supports the following attributes:

  • fromAlpha - 0.0 to 1.0, where 0.0 is transparent.
  • toAlpha - 0.0 to 1.0, where 0.0 is transparent.

<scale>
A resizing animation. Represents a ScaleAnimation. You can specify what is the center point of the image (the pinned center), from which it grows outward (or inward), by specifying pivotX and pivotY. So, for example, if these were 0, 0 (top left corner), all growth would be down and to the right. scale supports the following attributes:

  • fromXScale - Starting X size, where 1.0 is no change.
  • toXScale - Ending X size, where 1.0 is no change.
  • fromYScale - Starting Y size, where 1.0 is no change.
  • toYScale - Ending Y size, where 1.0 is no change.
  • pivotX - The X coordinate of the pinned center.
  • pivotY - The Y coordinate of the pinned center.
 
<translate>
A vertical/horizontal motion animation. Represents a TranslateAnimation. Supports the following attributes in any of the following three formats: values from -100 to 100, ending with "%", indicating a percentage relative to itself; values from -100 to 100, ending in "%p", indicating a percentage relative to its parent; a float with no suffix, indicating an absolute value.

  • fromXDelta - Starting X location.
  • toXDelta - Ending X location.
  • fromYDelta - Starting Y location.
  • toYDelta - Ending Y location.
 
<rotate>
A rotation animation. Represents a RotateAnimation. Supports the following attributes:

  • fromDegrees - Starting rotation, in degrees.
  • toDegrees - Ending rotation, in degrees.
  • pivotX - The X coordinate of the center of rotation, in pixels, where (0,0) is the top left corner.
  • pivotY - The Y coordinate of the center of rotation, in pixels, where (0,0) is the top left corner.
 
<interpolator tag>
You can also use any of the interpolator subclass elements defined in R.styleable. Examples include <CycleInterpolator>, <EaseInInterpolator>, and <EaseOutInterpolator>. These objects define a velocity curve that describes how quickly a visual action takes place on a timeline (fast at first and slow later, slow at first and gradually faster, and so on).

In addition to the attributes defined for each element above, the elements <alpha>, <scale>, <translate>, <rotate>, and <set> all support the following attributes (inherited from the Animation class):

duration
Duration, in milliseconds, for this effect.
startOffset
Offset start time for this effect, in milliseconds.
fillBefore
When set true, the animation transformation is applied before the animation begins.
fillAfter
When set true, the animation transformation is applied after the animation ends.
repeatCount
Defines the number of times the animation should repeat.
repeatMode
Defines the animation behavior when it reaches the end and the repeat count is greater than 0. Options are to either restart or reverse the animation.
zAdjustment
Defines the z-axis ordering mode to use when running the animation (normal, top, or bottom).
interpolator
You can optionally set an interpolator for each element to determine how quickly or slowly it performs its effect over time. For example, slow at the beginning and faster at the end for EaseInInterpolator, and the reverse for EaseOutInterpolator. A list of interpolators is given in R.anim. To specify these, use the syntax @android:anim/interpolatorName.

For more discussion and animation code samples, see the discussion in the 2D Graphics document.


(Ex) fade.xml



(Ex) hold.xml



(Ex) zoom_enter.xml



(Ex) zoom_exit.xml


'old > XML Attr' 카테고리의 다른 글

XML Attributes_TextView  (0) 2010.02.22
XML Attributes_LinearLayout  (0) 2010.02.22
Posted by jazzlife
,
(1) android:hint 

    Param : 표시할 내용.

       : 힌트로 내용을 표시한다.

(2) android:paddingBottom

    Param : 정수형 dip 값.

       화면에 상대적인 크기로 패딩을 준다.

(3) android:text

    Param : text, @string/name

        (예) "hello" : "hello"를 textview container에 표시
        (예) "@string/name : res/strings.xml에서 id가 name으로 되어 있는 텍스트를 표시

'old > XML Attr' 카테고리의 다른 글

XML Attributes_Animation  (0) 2010.02.22
XML Attributes_LinearLayout  (0) 2010.02.22
Posted by jazzlife
,

Linear Layout

  Linear Layout은 Box model이며 widgets과 child containers의 배치를 정의한다.
  Linear Layout Control을 위해서 다음 5가지 설정을 지원한다.

     
    • orientation,
    • fill model,
    • weight,
    • gravity
    • padding


1. android:orientation

    Param : vertical, horizontal

    "vertical" : 세로로 배치
    "horizontal" : 가로로 배치


2. android:layout_width, android:layout_height

    Param : fill_parent, wrap_content, (예) 125 px

    "fill_parent" : 가능한 영역을 전부 할당하여 표시
    "wrap_content" : 필요한 만큼의 영역만 할당하여 표시
    "-- px" : 예를들어 "125 px" 125 픽셀만큼만 할당하여 표시

3. android:layout_weight

    Param : 정수 값.

    "1", "2"...: 전체 비율에서 설정한 값만큼의 비율로 할당

4. android:layout_gravity

    Param : fill, top, bottom, center, left, right, center_vertical, fill_vertical, center_horizontal, fill_horizontal, dip_vertical, dip_horizontal

    : 정렬 방식을 지정한다.

5. android:padding

    Param : 픽셀 값.

    : widget에 padding을 지정하여 간격을 띄운다.

'old > XML Attr' 카테고리의 다른 글

XML Attributes_Animation  (0) 2010.02.22
XML Attributes_TextView  (0) 2010.02.22
Posted by jazzlife
,