본문 바로가기

전체 글236

[Android] View View 그리기 및 이벤트 처리를 담당하는 UI 구성요소의 기본 클래스*위젯을 작성하는 데 사용되는 기본 클래스 (새로운 위젯을 만들기 위해선 View 를 상속하여 구현해야 한다)위젯(컴포넌트) : View 를 상속받아 구현하는 TextView, Button 등 어떤 특수한 목적을 가지고 있는 View위젯들을 담는 부모 뷰 Layout 도 View 를 상속받는 *ViewGroup 을 상속받아 구현한다.ViewGroup : View 의 또 다른 서브 클래스이자 보이지 않는 컨테이너로, 다른 View 들을 포함할 수 있다. View 가 그려지는 과정뷰는 포커스를 받게 되면 Android 에게 View Hierarchy 의 루트 노드를 제공하여 레이아웃을 그리게 된다.액티비티의 onCreate() 내에서 se.. 2024. 10. 5.
[LeetCode][Kotlin] 80. Remove Duplicates from Sorted Array II 80. Remove Duplicates from Sorted Array IIGiven an integer array nums sorted in non-decreasing order, remove some duplicates in-place such that each unique element appears at most twice. The relative order of the elements should be kept the same. Since it is impossible to change the length of the array in some languages, you must instead have the result be placed in the first part of the array n.. 2024. 10. 4.
[Android] ConstraintLayout ConstraintLayout뷰를 배치할 때 *제약 조건을 사용하여 제어하는 방식을 사용한다.제약 조건 : 뷰가 레이아웃 안의 다른 요소와 어떻게 연결되는지 알려주는 것으로, 뷰의 연결점과 대상을 연결한다.뷰 간의 관계를 제약 조건으로 지정하여 뷰의 위치와 크기를 결정한다.LinearLayout, RelativeLayout 등의 레이아웃은 뷰의 위치를 상대적으로 지정하는 방식을 사용한다.예시: LinearLayout 에서는 뷰를 Vertical, Horizontal 하게 배치할 수 있고, RelativeLayout 은 뷰를 상대적으로 배치할 수 있다.제약 조건은 뷰의 상하좌우와 같은 위치, 크기, 비율 등을 지정할 수 있으며, 이를 통해 다양한 레이아웃을 구성할 수 있다. ConstraintLayout .. 2024. 10. 2.
[Android] px(pixel), dp(dip), sp 픽셀(pixel, px)화소라고도 하며, 디지털 이미지를 나타내는 데 사용되는 최소 단위이다.해상도와도 관련이 있는데, 동일한 이미지라 하더라도 픽셀의 수가 많은 것이 해상도가 더 높다.오른쪽 그림이 왼쪽 그림보다 1인치당 픽셀 수가 더 많으므로 해상도가 높다고 볼 수 있다.ppi(pixel per inch) = dpi(dot per inch) : 1인치당 픽셀 수 (즉, dot 이 곧 pixel 이다)안드로이드에서 애플리케이션에 이미지를 넣을 때, 픽셀 단위로 이미지를 넣으면 화면에 보이는 이미지 크기에 일관성이 없다는 문제점이 있다.사용자 스마트폰의 화면 크기가 다양하기 때문에 같은 이미지라도 화면에 따라 크기가 다르게 보일 수 있다.이러한 문제를 해결하기 위해 안드로이드에서는 픽셀 대신 dp 를 단.. 2024. 10. 1.
[LeetCode][Kotlin] 844. Backspace String Compare 844. Backspace String CompareGiven two strings s and t, return true if they are equal when both are typed into empty text editors. '#' means a backspace character. Note that after backspacing an empty text, the text will continue empty.두 개의 문자열 s와 t가 주어졌을 때, 둘 다 빈 텍스트 편집기에 입력했을 때 같으면 true를 반환합니다. '#'은 백스페이스 문자를 의미합니다. 빈 텍스트를 백스페이스한 후에는 텍스트가 계속 비어 있게 됩니다. Example 1:Input: s = "ab#c", t = "ad#c"Ou.. 2024. 10. 1.
[LeetCode][Kotlin] 680. Valid Palindrome II 680. Valid Palindrome IIGiven a string s, return true if the s can be palindrome after deleting at most one character from it.문자열 s가 주어지면, 최대 한 문자를 삭제한 후 s가 회문일 수 있으면 true를 반환합니다. Example 1:Input: s = "aba"Output: true Example 2:Input: s = "abca"Output: trueExplanation: You could delete the character 'c'. Example 3:Input: s = "abc"Output: false Constraints:1 s consists of lowercase English lette.. 2024. 9. 30.
[LeetCode][Kotlin] 799. Champagne Tower 799. Champagne TowerWe stack glasses in a pyramid, where the first row has 1 glass, the second row has 2 glasses, and so on until the 100th row.  Each glass holds one cup of champagne. Then, some champagne is poured into the first glass at the top.  When the topmost glass is full, any excess liquid poured will fall equally to the glass immediately to the left and right of it.  When those glasses.. 2024. 9. 25.