[초보자용] 안드로이드의 레이아웃 2를 해보도록 하겠습니다.
10678 단어 Android
개시하다
계속저번.
지난번에 정보 창까지 했어요.
5. 메뉴
다음은 메뉴를 만들겠습니다.
메시지의 오른쪽 아래에 겹쳐 표시됩니다.
↓ 완성도
5.1. 메뉴 경계 만들기
LinerLayout을 사용하여 레이아웃합니다.
GridLayout를 사용하면 끼워넣기 시스템이 다소 얕아질 것 같지만 판면 디자인 연습이기 때문에 여기는 하나밖에 없다.
(화살표 포함)
맨 안쪽 라인Layout에 ImageView
와 TextView
를 넣는다.
추기:
외부에 LiearLayout을 추가하여 검은색 테두리를 만듭니다.
5.1.1. 외부 검은색 상자 부분 삽입(LiearLayout)
다음은 메뉴를 만들겠습니다.
메시지의 오른쪽 아래에 겹쳐 표시됩니다.
↓ 완성도

5.1. 메뉴 경계 만들기
LinerLayout을 사용하여 레이아웃합니다.
GridLayout를 사용하면 끼워넣기 시스템이 다소 얕아질 것 같지만 판면 디자인 연습이기 때문에 여기는 하나밖에 없다.

(화살표 포함)
맨 안쪽 라인Layout에
ImageView
와 TextView
를 넣는다.추기:
외부에 LiearLayout을 추가하여 검은색 테두리를 만듭니다.
5.1.1. 외부 검은색 상자 부분 삽입(LiearLayout)


다음 값을 설정합니다.
attribute
value
layout_width
200dp
layout_height
match_parent
layout_gravity
right
background
#363f3a
padding
4dp
visibility
visible
padding 은 #363f3a 의 일부를 상자처럼 사용하기 위한 값이며 안쪽에 간격을 둡니다.
width
만들어서 200dp
하면 왠지 좀 그렇다.알맞다
5.1.1.1 android:visibility
android:visibility
에 설정visible
한 것은 앞으로'메뉴를 삭제하고 거꾸로 메뉴를 표시할 수 있도록'하기 위해서다.잠시 후setVisibility 이 방법으로 조작한 상황을 확인합니다.
5.1.2. 내부 경계 삽입
5.1.2.1. 배경 소재를 만들다
파일 작성 방법(확인용)

pokemon_battle_menu_frame.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#f9f8fe" />
<corners android:radius="8dp" />
<stroke
android:width="6dp"
android:color="#716b8f" />
</shape>
아래가 느껴지면 메뉴의 테두리로 사용할 수 있다.
5.1.2.2. 테두리를 두르다

이것은 메뉴의 경계선을 완성했다.
첨가한 부분은 아래와 같다.
pokemon_gba_battle.xml
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/pokemon_battle_menu_frame"
android:orientation="horizontal"
android:paddingBottom="12dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="12dp">
<!--here next-->
</LinearLayout>
그러면 선택 사항이 커서와 함께 정렬됩니다.5.2. 옵션 및 커서 작성
다음 4 개 선택
5.2.1. 세로로 배열된 LinerLayout 넣기

너비
width
는0dp
,layout_weight
는1
이다.넣는 거 잊지 마.
5.2.2. 선택 및 커서에 대한 LinearLayout 입력
android:orientation="vertical"
및 ImageView
가로,네 군데에 늘어놓다.



이렇게 해서
TextView
(커서) 와 ImageView
(선택할 수 있는) 모두 준비되었다.5.2.3. 입력 옵션 및 커서
5.2.3.1. 커서 소재 준비
drawable의vector를 사용할 수 있기 때문에 그것을 사용합니다.
새로 만들기
TextView
파일,<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M8,5v14l11,-7z"/>
</vector>
복사하고 붙여주세요.
나의 애인
참조:
5.2.3.2. 배치 옵션 및 커서
한 세트
ic_play_arrow.xml
와 ImageView
로 모두 4조입니다.
Header Two
layout_width
0dp
layout_height
wrap_content
layout_weight
1
src
@drawable/ic_play_arrow
Header Two
layout_width
0dp
layout_height
wrap_content
layout_weight
5
gravity
center_vertical
text
전투
이렇게 하기 위해
TextView
에서gravity
를 설정했다.5.2.3.2.1. gravity
android:gravity
배치의 어느 방향에 대한 접근을 설정할 수 있습니다.
이번
center_vertical
에 설정TextView
,내용 문자
center_vertical
의 값을'세로로 볼 때 가운데로'gravity로 설정합니다.5.2.3.3. visibility 설정
지금 메뉴가 아래 상태인 것 같습니다.

커서는 선택 상태의 커서만 표시해야 합니다.
가시적 상태/보이지 않는 상태의 값을
text
에 추가합니다.Header Two
layout_width
0dp
layout_height
wrap_content
layout_weight
1
src
@drawable/ic_play_arrow
visibility
visible (or invisible)
전투에서 볼 수 있는 상태를 설정하고,

이외에 3개(포켓몬스터백에 넣기)로 보이지 않는 상태를 설정합니다.

5.3. 메뉴 완료
그런 느낌이 들었어요.

5.3.1. 메뉴 꺼주세요.
첫번째그럼
ImageView
에 설정한 거 기억나세요?이렇게 하면
LinearLayout(horizontal)
메뉴를 표시하거나 삭제할 수 있습니다.

끝말
계속
coming soon
Reference
이 문제에 관하여([초보자용] 안드로이드의 레이아웃 2를 해보도록 하겠습니다.), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/rild/items/a54fadcec9130f767017
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
Reference
이 문제에 관하여([초보자용] 안드로이드의 레이아웃 2를 해보도록 하겠습니다.), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/rild/items/a54fadcec9130f767017텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)