Android Studio 20

[안드로이드 스튜디오] fragment에서 fragmentManager호출

getParentFragmentManager() 을 쓰면 된다. 코드 출처 https://stackoverflow.com/questions/20237531/how-can-i-access-getsupportfragmentmanager-in-a-fragment How can I access getSupportFragmentManager() in a fragment? I have a FragmentActivity and I want to use a map fragment within it. I'm having a problem getting the support fragment manager to access it. if (googleMap == null) { googleMap = (( stackoverflo..

Android Studio 2022.05.23

Material Bottom navigation 의 size 를 알아보자

위의 bottom navigation을 사용한다면 아래의 사이트에서 사이즈를 볼 수 있다. https://material.io/archive/guidelines/components/bottom-navigation.html#bottom-navigation-specs Bottom navigation - Components - Material Design The bottom navigation bar enables quick movement from deep in one topic to the top of another topic. Keep it available as the user descends the hierarchy, either by showing it persistently, or by conce..

Android Studio 2022.05.23

[error] This view is not constrained, it only has designtime positions, so it will jump to (0,0) unless you add constraints

[에러내용] This view is not constrained. It only has designtime positions, so it will jump to (0,0) at runtime unless you add the constraints [해결방법] "Infer Constraint" 옵션을 활성화하면 해결된다. 자세한 방법은 아래를 참고하자. https://stackoverflow.com/questions/45226854/this-view-is-not-constrained-it-only-has-designtime-positions-so-it-will-jump This view is not constrained, it only has designtime positions, so it will ju..

Android Studio 2022.05.23

[안드로이드 스튜디오] BottomNavigationView 사용하기

1. 라이브러리 추가 implementation 'com.google.android.material:material:1.5.0' sync 잊지말기! 2. res 에 menu 리소스 폴더를 추가하고 menu_bottom.xml 생성 3. menu_bottom.xml 에서 item (BottomNavigation 에 넣을 메뉴) 추가하기 여기서 만약 아이콘을 res 에 있는 xml 파일로 하고싶다면 android:icon="@drawable/menu_post_add_48" 과 같이 넣어주면 된다. (3-2 여기서 아이콘 클릭시 색깔을 변경하고 싶다면 drawable에 item_color.xml 파일을 추가하고 색깔을 지정해준다.) (예시) 눌렀을 경우 갈색 아닐경우 빨간색으로 설정했을 때이다. 4. acti..

Android Studio 2022.05.17

[안드로이드 스튜디오] logcat [DEAD]

작업을 하던 중 분명 정지 후 새로 앱을 실행했는데도 불구하고 로그켓이 갱신되지 않고 빈 화면인 현상이 일어났다. 검색을 한 결과 간단하게 껐다 키면 해결할 수 있어보여 안드로이드 스튜디오와 애뮬레이터를 종류 한 뒤 실행하여 해결하였다. 다음은 참고한 스택오버플로우 링크이다. https://stackoverflow.com/questions/31803618/cant-launch-application-through-android-studio-logcat-dead Can't launch application through Android Studio (logcat [DEAD]) For the last two days the app I'm working on is showing up as [DEAD] in log..

Android Studio 2022.05.17

[안드로이드 스튜디오]SearchView(Android/Androidx) import 하기

SearchView는 2가지가 있는데 검색 대화상자(search dialog)와 검색 위젯(search widget)이다. 간단하게는 위치로 구분할 수 있는데 1. 대화상자(dialog)의 경우 아래와 같이 위젯의 액션바에 위치하게 된다. 2. 위젯(widget)의 경우 아래와 같이 레이아웃 안에 자유롭게 배치시킬 수 있다. 임포트(import)는 검색 대화상자(search dialog)는 import android.widget.SearchView; 검색 위젯(search widget)은 import androidx.appcompat.widget.SearchView; 이다. 자세한 사용방법은 안드로이드 개발자 페이지를 살펴 보자. https://developer.android.com/guide/topic..

Android Studio 2022.05.05

[안드로이드 스튜디오] Logcat, Log 작성하고 확인하기

자바 파일에 Log.i("MyMemoApp", "MainActivity"); 와 같은 코드를 넣는다면 아래에 있는 Logcat에서 태그와 메세지를 확인할 수 있다. 나는 Log.i 를 선택했기에 info를 선택해서 정보만 확인을 했다. Log의 종류는 다음과 같다. 참고 문서 https://developer.android.com/studio/debug/am-logcat Logcat을 이용한 로그 작성 및 보기 | Android 개발자 | Android Developers Android 스튜디오에서 Logcat 창에 시스템 메시지를 표시하는 방법을 알아보세요. developer.android.com https://developer.android.com/reference/android/util/Log Log..

Android Studio 2022.03.22

[안드로이드 스튜디오] 로고엑티비티에서 메인엑티비티로 자동으로 넘어가게 만드는 코드!

복붙용해야 하는 코드! 1. onCreate 전 변수선언 코드 Thread thread; boolean interrupted = false; 2. onCreate 내부 삽입 코드 final Handler handler = new Handler(); final Runnable doNextActivity = new Runnable() { @Override public void run() { Intent intent = new Intent(LogoActivity.this, MainActivity.class); startActivity(intent); finish(); } }; thread = new Thread(){ @Override public void run() { SystemClock.sleep(2000..

Android Studio 2022.03.22