반응형

Mobile/Android(Kotlin) 45

[Android/Kotlin] Set Preference Screen and Send data to another Activity from preference

Hello i m GOLD. this time i m going to make a preference screen in my app, and send a data to another activity. 1. add implementation first, we need to add implementation about preference in build.gradle(module: app) then we can use it. cool. 2. Create Options Menu in MainActivity(or some activity) i m going to override onCreateOptionsMenu and onOptionsItemSelected. in onCreateOptionsMenu, i m g..

[Android/Kotlin] EditText 속성(커서, 밑줄, 하이라이트) 색깔 변경하기(cursor, highlight, bottom line color change)

안녕하세요 골드입니다. 오늘은 EditText에 있는 여러가지 속성들의 색깔을 변경해보도록 하겠습니다. 1. EditText 밑줄 색깔 변경 먼저 밑줄입니다. xml파일에서 간단한 속성 추가로 밑줄의 색깔을 변경할 수 있습니다. EditText 속성에 코드를 한 줄 추가합니다. 안드로이드 최신버전(4.0)에서 @color/colorPrimary의 색깔은 보라색입니다. 밑줄이 보라색으로 변경된 것을 볼 수 있습니다. 컬러만 여러분이 원하는 색상으로 바꾸면 되겠습니다. 1-1 코드로 색깔 변경 이번에는 xml이 아닌 .kt 파일입니다. 프로그래밍적으로 코드에서 어떻게 밑줄의 색깔을 바꾸는지 알아보겠습니다. 코드를 어디에 넣어야할지 잘 모르시겠다면 onCreate() 함수 안에 넣으면 됩니다. (참고로 bac..

[Android/Kotlin] Layout view visibility Slide Animation 구현하기

안녕하세요 골드입니다. 오늘은 Layout view(Widget)객체에 Slide Animation을 넣는 방법에 대해서 알아보겠습니다. 1. 부모 Layout에 코드 추가 먼저 저의 xml 파일에 구성은 굉장히 간단합니다. ConstraintLayout안에 TextView와 Button이 들어있는 간단한 xml파일입니다. 부모 레이아웃인 ConstraintLayout 안에 animateLayoutChanges = true를 입력합니다. 2. .kt 파일에 코드 추가 간단한 슬라이드 애니메이션을 적용하기 위해 TranslateAnimation을 구현합니다. TranslateAnimation은 x, y좌표의 델타값을 매개변수로 입력할 수 있습니다. https://developer.android.com/re..

[Android/Kotlin] RecyclerView 아이템 클릭과 액티비티로 데이터 전송(item click and pass data)

안녕하세요 골드입니다. 오늘은 RecyclerView item click 이벤트와 Adapter.kt 파일에서 다른 액티비티로 데이터를 보내는 방법에 대해서 글을 쓰도록 하겠습니다. RecyclerView를 생성하는 방법은 이곳을 참고하세요. https://kumgo1d.tistory.com/43 [Android/Kotlin] RecyclerView를 사용해서 ListView와 GridView 만들기 안녕하세요 골드입니다. 오늘은 Android에서 RecyclerView를 사용해서 ListView와 GridView를 만드는 방법에 대해서 글을 쓰도록 하겠습니다. Android Studio 3.1을 기준으로 안드로이드에서 정말 많이 사용� kumgo1d.tistory.com 1. RecyclerView i..

[Android/Kotlin] RecyclerView를 사용해서 ListView와 GridView 만들기

안녕하세요 골드입니다. 오늘은 Android에서 RecyclerView를 사용해서 ListView와 GridView를 만드는 방법에 대해서 글을 쓰도록 하겠습니다. Android Studio 3.1을 기준으로 안드로이드에서 정말 많이 사용되었던 ListView와 GridView가 레거시 코드가 되었습니다. 레거시 코드는 이전 버전과의 호환성을 위해 남겨두지만 다른 코드로 사용할 것을 권장한다는 뜻입니다. 레거시 카테고리에 포함된 두 코드를 대신해서 RecyclerView가 생겼습니다. 코드의 양이 조금 늘어났다고 볼 수도 있지만 다른 두 코드보다 효율적으로 설계되었습니다. 한 가지 예를 들자면 기존 ListView같은 경우 리스트가 100개 있다면 100개를 모두 불러왔지만, RecyclerView는 1..