안드로이드 개발 질문/답변
(글 수 45,052)
혼자 공부하면서 앱만들때는 UI에 별로 신경을 쓰지않아 몰랐는데
취직해서 디자이너랑 같이하게되니 레이아웃에서 막히는부분이 많네요..
디자이너가 배경이미지랑 버튼과 같은 부분 이미지를 하나씩 잘라주고 480*800해상도 기준으로 위치도 정해주는데
absolute로 하자니 해상도문제때문에 혼자 삽질하며 검색하다가 답이 잘안나와 아래와 같이 구성하게 되었습니다.
공백까지 linearlayout으로 처리해서 노가다가 많지만 그래도 잘 보이긴 하더라구요...
언제까지 이런 임시적인 방편으로 개발을 할수는 없을것 같아 질문 드립니다.
여기 계시는 선배 개발자님들은 어떻게 레이아웃을 구성하시는지 알려주시면 감사하겠습니다 ㅠㅠ
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:background="@drawable/practice_intro_bg"> <LinearLayout android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight="7" /> <LinearLayout android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight="52"> <LinearLayout android:layout_width="0dp" android:layout_height="fill_parent" android:layout_weight="343"/> <LinearLayout android:layout_width="0dp" android:layout_height="fill_parent" android:layout_weight="120"> <ImageView android:layout_width="fill_parent" android:layout_height="fill_parent" android:clickable="true" android:src="@drawable/btn_exit_selector" android:id="@+id/btn_exit" android:scaleType="fitXY" /> </LinearLayout> <LinearLayout android:layout_width="0dp" android:layout_height="fill_parent" android:layout_weight="17"/> </LinearLayout> <LinearLayout android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight="530" /> <LinearLayout android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight="58"> <LinearLayout android:layout_width="0dp" android:layout_height="fill_parent" android:layout_weight="155"/> <LinearLayout android:layout_width="0dp" android:layout_height="fill_parent" android:layout_weight="170"> <ImageView android:layout_width="fill_parent" android:layout_height="fill_parent" android:clickable="true" android:src="@drawable/btn_start_selector" android:id="@+id/btn_start" android:scaleType="fitXY" /> </LinearLayout> <LinearLayout android:layout_width="0dp" android:layout_height="fill_parent" android:layout_weight="155"/> </LinearLayout> <LinearLayout android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight="153" /> </LinearLayout>
오우.... 감히 말씀드리지만 저 xml은 정말 않좋은 케이스라고 확신합니다.
저렇게 하신 이유를 딱히 잘 모르겠습니다. 해상도 대응때문이라면 해상도대응하여 구성을 하셔야 합니다.
dip를 사용하시고, weight의 적절한 사용, 그 외의 layout 구성 기능들을 전부 활용하셔야 할것 같습니다.
큰 의미가 없는 레이아웃이 너무 많습니다.
타겟 해상도가 480 800이라면 디자인을 480 800에 딱 맞게 모든 디자인을 하시면 도움이 될 것 같습니다.