반응형
main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<Button
android:id="@+id/basebtn"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="기준위젯"/>
<Button
android:id="@+id/btn1"
android:layout_alignTop="@+id/basebtn"
android:layout_toLeftOf="@+id/basebtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1번"/>
<Button
android:id="@+id/btn2"
android:layout_below="@+id/btn1"
android:layout_toLeftOf="@+id/basebtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2번"/>
<Button
android:layout_below="@+id/btn2"
android:layout_toLeftOf="@+id/basebtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="3번"/>
<Button
android:layout_above="@+id/basebtn"
android:layout_alignLeft="@+id/basebtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="4번"/>
<Button
android:layout_alignRight="@+id/basebtn"
android:layout_below="@+id/basebtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="5번"/>
<Button
android:layout_above="@+id/basebtn"
android:layout_toRightOf="@+id/basebtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="6번"/>
</RelativeLayout>
반응형
'Programming > Android' 카테고리의 다른 글
안드로이드 프로그래밍 테이블레이아웃계산기 (안드로이드 예제) (0) | 2021.08.16 |
---|---|
안드로이드 프로그래밍 직접풀어보기5-4 (안드로이드 예제) (0) | 2021.08.16 |
안드로이드 프로그래밍 직접 풀어보기 5-3 (안드로이드 예제) (0) | 2021.08.16 |
안드로이드 프로그래밍 5장 직접풀어보기 5-2 (안드로이드 예제) (0) | 2021.08.16 |
안드로이드 프로그래밍 4장 연습문제9 (안드로이드 예제) (0) | 2021.08.16 |