• [Android] DataBinding 데이터 바인딩

    DataBinding findViewById 하는게 아니라, UI와 실제 데이터를 연결해놔서 어느 액티비티에서든 일일이 findView하지 않아도 사용할 수 있도록 도와주는 라이브러리. // build.gradle (Module:app) 에서 dataBinding.enabled = true; // 데이터로 채워진 Class, 예를 들어 아래와 같은 class와 연결. public class SampleInfo { public String name; public int age; public timeStamp currentTime; } dataBinding을...


  • [Android] Clicked Item 클릭 처리

    Clicked Item RecycleView 같은 곳에서 클릭 이벤트 발생 시 적용되는 레이아웃. drawable에 파일 생성. (drawable - selector 의 root element) 배경 색을 바꾸는 것으로 지정할 경우, <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@color/colorPrimaryLight" android:state_pressed="true"/> <item android:drawable="@color/colorPrimaryLight" android:state_activated="true"/> <item android:drawable="@color/colorPrimaryLight" android:state_selected="true"/> // 위 3개는 "클릭" 상태의 값 <item android:drawable="@android:color/background_light" /> // default 값 </selector>...


  • [Android] Vector 벡터 리소스 사용하기

    SVG 등의 벡터 이미지 사용하기 컴퓨터에 이미지 다운로드 New - Vertor Asset - Local file - Size Override(자동 비율) Auto Mirroring drawable 폴더에 xml 파일로 표시된다. ImageView 의 Background를 xml 파일로 지정.


  • [Android] ConstraintLayout 레이아웃

    언제부턴가 Android Studio에서 ConstraintLayout 를 강력하게 밀고 있는 듯하다. New project를 만들면 기본적으로 생성되는 “Hello World!” 텍스트가 있는 액티비티도 ConstraintLayout으로 생성된다. ConstraintLayout란 ConstraintLayout(컨스트레인트 레이아웃)은 위치와 크기 조절을 유연하게 할 수 있는 ViewGroup이다. 다양한 해상도를 지원하는 앱 작업을 할 때 상당히 편리하다. 아래 예제는 같은 코드로 작성한 xml 파일을 다른 기기(해상도)에서...


  • [Android] Service 안드로이드 서비스

    Service UI에 영향을 주지 않거나, 백그라운드에서 비교적 오래 걸리는 작업을 수행할 때 사용. Loader 를 쓸때-> 액티비티에서만 로딩 작업이 쓰일때, 생명주기와 연관돼있을때, UI에 영향을 줄때 Service 를 쓸때-> 데이터의 최종 결과가 UI에 영향을 주지 않을 때. Service를 시작하는 방법 Start(수동 시작) startservice() : 강제 시작 할수 있으나, 컴포넌트와 통신을 하지는...