티스토리 뷰

안드로이드 앱 개발자가 제안하는 디자인 방법론 - 4. 가이드 작성법 1




이전시간에 안드로이드는 dp(or dip)단위를 쓰기 때문에 어떠한 해상도에서든 같은 크기를 보여준다고 이야기 했으며 스케일링이 된다고 설명했다. 하지만 폰마다 가로 dp가 모두 다르기때문에 스케일링 만으로 다양한 기기를 지원하기가 어렵다. 


2013/03/11 - [개발관련/Android] - 안드로이드 앱 개발자가 제안하는 디자인 방법론 - 3. DPI, DIP(DP) 개념



그렇다면 어떤식으로 디자인 해야 되며, 가이드라인을 만들지에 대해 알아 보자.



왜 스케일링 만으로 모든폰을 지원 못하는지에 대해 간단한 예제를 통해 알아 보자.



디자이너가 좌우 2개의 이미지와 중간에 타이틀을 넣고 싶어 하는 액션바를 디자인 한다고 가정해보자. 1280x720사이즈를 기본으로 위와 같은 작업은 가이드작업을 할 것이다.

이 가이드를 바탕으로 개발자는 아래와 같은 레이아웃 작업을 할것이다.


Test Case

drawable-xhdpi 폴더 r.png, p.png, g.png, r.png


Layout

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<!--
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#EEEEEE">
     
    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="5dip"
        android:src="@drawable/b" />
     
    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/g" />
     
    <TextView
        style="@style/ActionBarTextView"
        android:text="TITLE" />
     
    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/r" />
     
    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginRight="5dip"
        android:src="@drawable/p" />
     
</LinearLayout>
-->


Style

1
2
3
4
5
6
7
<!--
    <style name="ActionBarTextView">
        <item name="android:layout_width">110dip</item>
        <item name="android:gravity">center</item>
    </style>
 
-->




레아웃을 작업 후 Xhdpi단말기에서는 가이드라인과 같은 레이아웃 구성이 된것을 볼수 있다. 하지만, Hdpi단말기를 보면 오른쪽 보라색 박스가 깨진것을 볼 수있다.

왜이렇게 이미지가 작아져 버릴까.


단순하다. xhdpi단말기의 가로는 360dp이고 hdpi단말기는 320dp이다. hdpi단말기의 가로가 40dp이 모자라기때문에 더이상 그리지 못하고 작아진것이다.

이처럼 레이아웃 구성에 따라 작아지거나, 짤리는 경우가 있다.



그럼 어떤식으로 가이드라인을 작성 하면 될지 개발자가 직접 그린 가이드라인을 보자.



단순하다. 타이틀 부분을 동적으로 꽉차게 기준을 주는것이다. 이것은 개발자와 디자이너와 약속을 정하고 특정문자로 대체 하면 좋을듯 한 방법이다.

결론은 특정 View에 동적인 기준을 준다는 것이다.


Padding이나 Margin 값 또는 특수한 경우를 제외한 나머지 이런식으로 가이드를 작성하면 된다.


Layout

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<!--
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#EEEEEE">
     
    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="5dip"
        android:src="@drawable/b" />
     
    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/g" />
     
    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:gravity="center"
        android:text="TITLE" />
     
    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/r" />
     
    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginRight="5dip"
        android:src="@drawable/p" />
     
</LinearLayout>
-->


이런 가이드라인을 통해 개발자는 위와같은 레이아웃 배치를 할 것이다. 그럼 아래와 같이 모든 폰에서도 잘 보이게 된다.


<1024 x 768> xhdpi 옵티머스 뷰


<1280 x 720> xhdpi 갤럭시 S3


<800 x 480> hdpi 갤럭시 S1


타이틀 부분이 동적으로 늘어나거나 줄어들어서 화면의 사이즈에 맞추는 것을 볼 수있다. 


하지만, hdpi용 타이틀 부분이 너무 작아서 디자이너가 만족 하진 못할 수도 있다. 그럴땐 hdpi용으로 좀더 작은 사이즈의 아이콘을 한벌 더 만들어 넣으면 해결 된다.  



이처럼 가이드시 dp으로 절대적인 수치가 아닌 상대적인 표현을 하는것이 가장 중요하다.

댓글

파트너스 활동을 통해 일정액의 수수료를 제공받을 수 있음



Total
Today
Yesterday
최근에 달린 댓글