'XML Attributes'에 해당되는 글 9건

  1. 2010.02.22 style
  2. 2010.02.22 기본 UI 생성 순서
  3. 2010.02.22 XML Attributes_Animation
  4. 2010.02.22 R.anim
  5. 2010.02.22 R.integer
  6. 2010.02.22 AlphaAnimation for Fading Animation
  7. 2010.02.22 Dimension
  8. 2010.02.22 XML Attributes_TextView
  9. 2010.02.22 XML Attributes_LinearLayout

style

old/UI Design 2010. 2. 22. 20:40

styles.xml

<?xml version="1.0" encoding="utf-8"?> 
<resources>
 
   
<style name="CodeFont" parent="@android:style/TextAppearance.Medium">
 
       
<item name="android:layout_width">fill_parent</item>
 
       
<item name="android:layout_height">wrap_content</item>
 
       
<item name="android:textColor">#00FF00</item>
 
       
<item name="android:typeface">monospace</item>
 
   
</style>
 
</resources>


R.style에서 다양한 속성들을 상속받아서 style로 사용한다.

(ex)
<style name="CodeFont" parent="@android:style/TextAppearance.Medium"> 

<style  name="Theme.CutomDialog" parent="android:style/Theme.Dialog">

 
상속받은 item을 정의 한다.
       
<item name="android:textColor">#00FF00</item> 
<item name="android:typeface">monospace</item>

<item name="android:windowBackground">@drawable/filled_box</item>


다른 곳에서 레이아웃을 불러와서 style을 적용하기도 한다.

[/drawable/filled_box.xml]
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="#f0600000"/>
    <stroke android:width="3dp" color="#ffff8080"/>
    <corners android:radius="3dp" />
    <padding android:left="10dp" android:top="10dp"
        android:right="10dp" android:bottom="10dp" />
</shape>


사용하기
<EditText 
   
style="@style/Numbers"     ... />

이런 식으로 activity 전체에 style 적용하기도 한다.

[AndroidManifest.xml]
        <activity android:name=".ActivityCustomDialog"
                  android:label="@string/app_name"
                  android:theme="@style/Theme.CutomDialog">

'old > UI Design' 카테고리의 다른 글

Notification  (0) 2010.06.17
UI 이벤트 처리  (0) 2010.06.15
기본 UI 생성 순서  (0) 2010.02.22
R.anim  (0) 2010.02.22
R.integer  (0) 2010.02.22
Posted by jazzlife
,

1. Layout source를 작성한다.
2. values/strings.xml을 작성한다.
3. values/styles.xml을 작성한다.
4. 그 외 drawable에 필요한 source를 작성한다.
4. src/source를 작성한다.
5. AndroidManifest.xml을 작성하여 연결시킨다.

'old > UI Design' 카테고리의 다른 글

UI 이벤트 처리  (0) 2010.06.15
style  (0) 2010.02.22
R.anim  (0) 2010.02.22
R.integer  (0) 2010.02.22
AlphaAnimation for Fading Animation  (0) 2010.02.22
Posted by jazzlife
,

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
,

R.anim

old/UI Design 2010. 2. 22. 13:11

acclerate_decelerate_interpolator :

accelerate_interpolator :

anticipate_interpolator :

anticipate_overshoot_interpolator :

bounce_interpolator :

decelerate_interpolator :

fade_in :

fade_out :

linear_interpolator :

overshoot_interpolator :

slide_in_left :

slide_out_right :

'old > UI Design' 카테고리의 다른 글

style  (0) 2010.02.22
기본 UI 생성 순서  (0) 2010.02.22
R.integer  (0) 2010.02.22
AlphaAnimation for Fading Animation  (0) 2010.02.22
Dimension  (0) 2010.02.22
Posted by jazzlife
,

R.integer

old/UI Design 2010. 2. 22. 12:21

애니메이션 효과가 진행되는 시간을 지정된 값으로 설정.

Param : (int) config_longAnimTime, config_mediumAnimTime, config_shortAnimTime

(예)

'old > UI Design' 카테고리의 다른 글

style  (0) 2010.02.22
기본 UI 생성 순서  (0) 2010.02.22
R.anim  (0) 2010.02.22
AlphaAnimation for Fading Animation  (0) 2010.02.22
Dimension  (0) 2010.02.22
Posted by jazzlife
,
<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.




(Ex)


 

'old > UI Design' 카테고리의 다른 글

style  (0) 2010.02.22
기본 UI 생성 순서  (0) 2010.02.22
R.anim  (0) 2010.02.22
R.integer  (0) 2010.02.22
Dimension  (0) 2010.02.22
Posted by jazzlife
,

Dimension

old/UI Design 2010. 2. 22. 12:09
px
Pixels - corresponds to actual pixels on the screen.

in
Inches - based on the physical size of the screen.

mm
Millimeters - based on the physical size of the screen.

pt
Points - 1/72 of an inch based on the physical size of the screen.

dp
Density-independent Pixels - an abstract unit that is based on the physical density of the screen. These units are relative to a 160 dpi screen, so one dp is one pixel on a 160 dpi screen. The ratio of dp-to-pixel will change with the screen density, but not necessarily in direct proportion.
Note: The compiler accepts both "dip" and "dp", though "dp" is more consistent with "sp".

sp
Scale-independent Pixels - this is like the dp unit, but it is also scaled by the user's font size preference. It is recommend you use this unit when specifying font sizes, so they will be adjusted for both the screen density and user's preference.

'old > UI Design' 카테고리의 다른 글

style  (0) 2010.02.22
기본 UI 생성 순서  (0) 2010.02.22
R.anim  (0) 2010.02.22
R.integer  (0) 2010.02.22
AlphaAnimation for Fading Animation  (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
,