본문 바로가기
Layout

AbsoluteLayout (절대적 배치 방식)

by 하드락 2022. 10. 2.

AbsoluteLayout (절대적 배치 방식)

 

AbsoluteLayout 자식 뷰들의 x, y 절대적 좌표를 정확하게 배치하고자 사용된다.

 

android.widget.AbsoluteLayout.LayoutParams
android:layer_x
android:layer_y
부모 레이아웃안에서 뷰의 왼쪽 최상단 모서리에서의 x, y 절대 좌표.
(단위 : px, in, mm, pt, dp, sp)

 

AbsoluteLayout 예제 #1

< /res/layout/main.xml >

<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_x="0.0px"
        android:layout_y="0.0px"
        android:text="Upper Left"/>

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_x="140.0px"
        android:layout_y="200.0px"
        android:text="Middle"/>

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_x="240.0px"
        android:layout_y="400.0px"
        android:text="Lower Right"/>

</AbsoluteLayout>

 

< RUN >

 

'Layout' 카테고리의 다른 글

RelativeLayout (상대적 배치 방식)  (0) 2022.10.02
TableLayout (표 배치 방식)  (0) 2022.10.02
LinearLayout (직선형 배치 방식)  (0) 2022.10.02
FrameLayout (중첩 배치 방식)  (0) 2022.10.02
레이아웃 (Layout)  (2) 2022.10.02

댓글