이 전에 기본 화면으로 인텐트 해주는 코드를 작성했다면 이번에는 액션바에 옵션메뉴 달고 옵션메뉴로 인물 등록을 할 수 있도록 하고 인물 정보로 인텐트 하는 코드를 작성해 볼 것이다.
새로운 액티비티 만든다.
Basic Activity 선택, 이름은 PersonRegistApp
res에서 내비게이션폴더를 삭제,
레이아웃을 열고 activity_main 클릭, 플로팅 떠다니는 옵션 레이아웃의 브레그먼크퍼스트 프레그먼트세컨드 삭제,
자바도 메인만 남기고 삭제한다.
액티비티메인 보면 툴바랑 위젯이 있음 미리 세팅되어 있다. 그래서 안 쓰는 것들 지워줘야 한다.
25라인에 있는 프롤팅액션버튼은 삭제
content_main에서 <fragment 삭제
레이아웃을 삭제하고 하고 LinearLayout로 변경한다.
LinearLayout으로 변경했으니 방향을 줘야 한다.
이미지 logo.png를 저장해서 drawable에 넣는다.
이제 content_main에 이미지를 넣는다.
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/logo"
android:layout_gravity="center"
android:layout_marginTop="100dp"
android:adjustViewBounds="true"/>
이제 메뉴를 오른쪽 상단 햄버거 버튼에 붙여야 한다. 지금은 그냥 어디에 붙여주는 것만..
content_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="30dp"
android:background="#1061380B"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/logo"
android:layout_gravity="center"
android:layout_marginTop="100dp"
android:adjustViewBounds="true"/>
</LinearLayout>
'Android' 카테고리의 다른 글
[Android Studio] 인물 정보 입력 & 등록하기 (2) (0) | 2024.05.11 |
---|---|
[Android Studio] 비디오 재생 (2) (0) | 2024.05.10 |
[Android Studio] 비디오 재생 (1) (0) | 2024.05.10 |
[Android Studio] 아이콘 바꾸는 방법 (0) | 2024.05.09 |
[Android Studio] 안드로이드 스튜디오 버전 지정 설치 방법 (0) | 2024.05.09 |