본문 바로가기

개발여행

검색하기
개발여행
프로필사진 Titan.

  • 분류 전체보기 (45)
    • 여행 (0)
    • 메모장 (0)
    • Mobile (11)
      • Kotlin (9)
      • Flutter (2)
    • Web (3)
      • React (3)
      • Django (0)
    • ML (0)
    • BlockChain (6)
    • Linux (3)
    • Algorithm (13)
    • Python (9)
    • C++ (0)
Guestbook
Notice
Recent Posts
Recent Comments
Link
«   2025/08   »
일 월 화 수 목 금 토
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
Tags
  • 안드로이드 스튜디오
  • 딕셔너리 복사
  • View.GONE
  • setVisibility
  • 코틀린
  • 뷰크기
  • cyclic imports
  • 0xC00000FD
  • 자바
  • 파이썬 문법
  • 1073741571
  • 이미지크기
  • Kotlin
  • python #circular imports #
  • Java
  • 버튼크기
more
Archives
Today
Total
관리 메뉴
  • 글쓰기
  • 방명록
  • RSS
  • 관리

목록이미지크기 (1)

개발여행

Kotlin 위젯 사이즈 코드에서 동적으로 조절하기

val r: Resources = resources var width = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 80F, r.displayMetrics).toInt() var height = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 90F, r.displayMetrics).toInt() binding.btn1.updateLayoutParams { width = width height = height } 위와 같은 방법으로 xml이 아닌 엑티비티(또는 프래그먼트) 코드 내에서 위젯의 크기를 조절할 수 있다. 상단의 width, height 선언없이 곧바로 Int 값을 넣어줘도 작동은 하지만 ..

Mobile/Kotlin 2022. 6. 21. 01:05
이전 Prev 1 Next 다음

Blog is powered by kakao / Designed by Tistory

티스토리툴바