본문 바로가기

IT/Android

(51)
안드로이드 스튜디오 / Expecting android:screenOrientation="unspecified" or "fullSensor" for this activity so the user can use the application in any orientation and provide a great experience on Chrome OS devices tools:ignore="LockedOrientationActivity" manifest에 "LockedOrientationActivity" 추가하면 된다. https://stackoverflow.com/questions/60396601/expecting-androidscreenorientation-unspecified-or-fullsensor-for-this-a
코틀린 / let, with, run, apply, also let : 지정된 값이 null이 아닌 경우에 코드를 실행해야 하는 경우 with : null이 될 수 없는 수신객체, 결과가 필요하지 않은 경우 run : 어떤 값을 계산할 필요가 있거나 여러개의 지역 변수의 범위를 제한하는 경우 apply : 수신 객체 람다 내부에서 수신 객체의 함수를 사용하지 앟고 수신 객체를 자신을 다시 반환하는 경우 also : 수신 객체 람다가 전달된 수신 객체를 전혀 사용하지 않거나 수신 객체의 속성을 변경하지 않고 사용하는 경우 https://kotlinlang.org/docs/coding-conventions.html
안드로이드 스튜디오 / To get local formatting use getDateInstance(), getDateTimeInstance(), or getTimeInstance(), or use new SimpleDateFormat(String template, Locale locale) with for example Locale.US for ASCII dates. val date = SimpleDateFormat("yyyyMMdd").parse(value) To get local formatting use getDateInstance(), getDateTimeInstance(), or getTimeInstance(), or use new SimpleDateFormat(String template, Locale locale) with for example Locale.US for ASCII dates. 현재날짜를 받고싶었는데, 해당 경고가 뜬다. Locale 클래스는 해당 지역의 정보를 담고 있는 클래스. 해당 지역의 정보를 추가해주면 경고가 사라진다. val date = SimpleDateFormat("yyyyMMdd", Locale.getDefault()).pa..
안드로이드 스튜디오 / koin 으로viewModel 의존성 주입 시 viewModel을 공유할 경우 2개 이상의 View가 1개의 ViewModel을 공유할 경우 by sharedViewModel()로 주입한다. 단, Fragment에서만 사용. 부모 Activity에서는 by viewModel() 사용하면 된다.
안드로이드 스튜디오 / Constraintlayout app 속성 layout_constraint방향_to방향of속성을 이용해서 각 위젯간 관계를 설정해줄 수 있다. top 위 bottom 아래 start 왼쪽 end 오른쪽 ex) android:id="@+id/text_view1" app:layout_constraintBottom_toTopOf="@+id/text_view2" -> text_view1의 Bottom(아래부분)을 text_view2의 Top(위)에 위치시킨다. android:id="@+id/text_view2" app:layout_constraintTop_toBottomOf="@+id/text_view1" -> text_view2의 Top(위)을 text_view1의 Bottom(아래)에 위치시킨다. !! constraintBottom_ cosntrai..
안드로이드 스튜디오 / Google SignInButton Text 수정 방법 구글 로그인 버튼의 Text를 바꾸고 싶었다. 조금 옛날 글이지만 역시.. 해결책은 존재했다. https://stackoverflow.com/questions/18040815/can-i-edit-the-text-of-sign-in-button-on-google/27838453#27838453 Can I edit the text of sign in button on Google? I am integrating my application with google plus. I have installed google play services and signed in to my account. Also I could publish and plus one for what ever I want. My problem I..
안드로이드 스튜디오 / layout 둥근 모서리 적용 1. drawable 폴더 안에 layout_radius.xml 파일 생성 shape으로 감싸고 안에 상세 속성들을 넣어준다. - solid : 뷰의 background - corners : 모서리 부분 bottomRightRadius, bottomLeftRadius, topLeftRadius, topRightRadius 따로 적용 가능 2. layout에 적용 android:background="@drawable/layout_radius"
안드로이드 스튜디오/ Retrofit/OkHttpClient 로그 찍는 방법 Retrofit에서 모든 통신을 로그찍어서 보고 싶다면 addInterceptor를 해주면 된다. //설명추가 예정 val httpLoggingInterceptor = HttpLoggingInterceptor() httpLoggingInterceptor.apply{ httpLoggingInterceptor.level = HttpLoggingInterceptor.Level.BODY } OkHttpClient.Builder() .addInterceptor(httpLoggingInterceptor) .build()

반응형