android:layout_height="0dp"로 설정하면
부모 레이아웃에서 사용 가능한 공간에 따라 높이를 동적 조정 가능
android:alpha
이미지의 투명도를 설정
0.0은 완전 투명, 1.0은 완전 불투명
app:layout_constraintDimensionRatio
뷰의 가로와 세로의 비율을 설정
constraintlayout를 새로 만들어서 한다면
그 constrainlayout 크기에 맞추어 비율을 설정 가
app:layout_constrainVertical_bias
뷰가 수직으로 어디에 위치할지를 결정
0은 부모의 상단, 1은 부모의 하단
0.414이면? 41.4%에 위치
Guideline
레이아웃 작성 시에 가이드라인을 잡아줌.
가상의 선을 그어서
view들의 constraint를 줄 수 있게 도와주는 역할.
ImageView를 넣는다면
위, 아래, 왼쪽, 오른쪽에 가이드라인으로
네모를 만들어서 거기에 constraint를 준다.
이 때 ImageView는 width, height 모두 "0dp"
<androidx.constraintlayout.widget.Guideline
android:id="@+id/logo_top"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.080"/>
1. id 설정
2. layout_width, layout_height
3. orientation
horizontal이면 가로줄, vertical이면 세로줄
4. layout_constraintGuide_percent
화면의 시작을 0%, 화면의 끝을 100%로 생각하고
전체 화면에 대해 몇 퍼센트 위치에 있는지 정해줌.
<View
android:id="@+id/spacer"
android:layout_width="0dp"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintDimensionRatio="1:8"
app:layout_constraintLeft_toRightOf="@id/headphone_icon"
app:layout_constraintTop_toTopOf="parent"/>
View를 사용하여 ConstraintLayout에서 공백이나 간격을 표현
내용이 없는 빈 'View'를 추가
font 설정
res에 font 폴더 만들어서 font를 넣는다.
android:fontFamily="@font/pretendard_bold"
텍스트 크기를 자동으로 조정하는 방식을 지정
"uniform" 텍스트 크기가 일관된 비율로 자동 조정
android:autoSizeTextType="uniform"
contentDescription
시각 장애인을 위 string 값을 읽어준다.
android:contentDescription="@string/btn_start_text"
Activity의 onCreate에 아래의 코드를 넣으면
화면 가득 채워진다.
Window window = getWindow();
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
'안드로이드 프로그래밍' 카테고리의 다른 글
All about Intent (0) | 2024.03.24 |
---|---|
뷰 바인딩 (0) | 2024.03.24 |
Json 기초 (0) | 2024.03.22 |
RecyclerView (0) | 2024.03.22 |
단위 변환기 앱 (0) | 2023.11.16 |