Apple is Apple

일일 회고

 

금요일이 끝났다! 

 

개인과제 제출을 완료했고, 선발대 과제도 해놓았다.

 

이제 2주간 프로젝트를 앞두고 있는데, 이를 위해 주말은 쉬는 시간을 가져봐야겠다!

 

그래도 너무 놀지만 말고 복습도 조금 해보자...!


오늘의 키워드

  • 알고리즘
  • ConstraintLayout Group

1. 알고리즘

 

[programmers][Kotlin] 개인정보 수집 유효 기간

문제 설명 고객의 약관 동의를 얻어서 수집된 1~n번으로 분류되는 개인정보 n개가 있습니다. 약관 종류는 여러 가지 있으며 각 약관마다 개인정보 보관 유효기간이 정해져 있습니다. 당신은 각

aaapple.tistory.com

2.  

3. androidx.constraintlayout.widget.Group

ConstraintLayout을 사용할 때, 내부의 다양한 위젯들의 동일한 속성을 한 번에 제어해고 싶은 경우가 있다.

보통, binding.xxx 를 통해 위젯에 접근하고 속성, 리스너등 제어를 하게 되지만, 코드가 보기 싫고, 길어질 것이다.

이때, 위젯들을 새로운 레이아웃으로 감싸 제어를 할 수 있겠지만, Constraint layout을 사용하는 의미가 퇴색 될 것이다.

이때, Group을 사용하면 된다. Group에 한 번에 제어할 속성을 모두 선언한 뒤, 코드상에서 제어할 수 있다.

<html />
<androidx.constraintlayout.widget.Group android:id="@+id/playerViewGroup" android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="gone" tools:visibility="visible" app:constraint_referenced_ids="trackTextView, artistTextView, coverImageCardView, bottomBackgroundView, playerSeekBar, playTimeTextView, totalTimeTextView"/> <TextView android:id="@+id/trackTextView" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <TextView android:id="@+id/artistTextView" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <TextView android:id="@+id/titleTextView" android:layout_width="wrap_content" android:layout_height="wrap_content"/> ....

 

묶을 위젯들을 app:constraint_referenced_ids속성에 선언하고

<html />
binding?.playerViewGroup?.isVisible = true

 

코드에서 Group에 접근하여 속성 등을 제어 할 수 있다.

 

묶여서 한 번에 컨트롤이 필요한 경우에는 아주 유용하게 쓰일 수 있다.

profile

Apple is Apple

@mjjjjjj