본문 바로가기
728x90

java35

[android studio] design 라이브러리 추가시 오류 implementation 'com.android.support:design:28.0.0' 위와같이 입력하였는데, 에러가 나온다. com.android.support:design:28.0.0 경로는 com.google.android.material:material:1.0.0-rc01 위의 경로로 변경되었다. dependencies안에 변경된 경로로 수정 후 해당 오류가 해결되었다. 2021. 10. 24.
[android studio] android build.gradle 에 androidX이외의 라이브러리 추가 후 오류시 gradle.properties에 아래 속성을 추가하면 문제가 해결 #AndroidX 이외의 라이브러리 사용 android.enableJetifier=true #AndroidX 라이브러리 사용 android.useAndroidX=true 2021. 10. 24.
[android studio] 디버깅(debuging) 단축키 Shift + F9 :디버깅 시작 F9 : 다음 중단점 만날 때까지 실행 F7 : 멈춘 라인의 메서드 상세히 보기 Shift + F8 : 현제 메서드 빠져나갈 때까지 실행 F8 : 소스 코드 한줄 실행 alt + F9 : 마우스 커서 위치까지 실행 ctrl + alt + F9 : 마우스 커서 위치까지 강제 실행 2021. 10. 24.
[android studio] image 회전시키기, bitmap 이미지 회전 아래 메서드를 이용하여 이미지를 회전 시킬 수 있다. // 이미지 회전 함수 public Bitmap rotateImage(Bitmap src, float degree) { // Matrix 객체 생성 Matrix matrix = new Matrix(); // 회전 각도 셋팅 matrix.postRotate(degree); // 이미지와 Matrix 를 셋팅해서 Bitmap 객체 생성 return Bitmap.createBitmap(src, 0, 0, src.getWidth(), src.getHeight(), matrix, true); } drawable을 bitmap으로 변환시킨 뒤 회전처리를 할 수도 있고, imageView의 이미지를 아래와 같이 BitmapDrawable로 변환시킨 뒤 bitmap.. 2021. 10. 24.
[android studio] Drawable을 Bitmap으로, Bitmap을 Drawable로 변경하기 Drawable을 Bitmap으로 변경 Bitmap bitmap = BitmapFactory.decodeResource(getResources(),R.drawable.[drawable명칭]); 또는, Bitmap bitmap = ((BitmapDrawable)drawable).getBitmap(); Bitmap을 Drawable로 변경 Drawable drawable = new BitmapDrawable(bitmap); Drawable을 Bitmap으로 변경한 뒤 canvas에 넣거나 수정할 경우 [Immutable bitmap passed to Canvas constructor]라는 예외 error가 발생하는 경우가 있다. 이런경우, 아래와 같이 bitmap을 복사한 뒤 사용하면 error를 피해갈 수.. 2021. 10. 24.
[android studio] MPAndroidChart 차트 구현하기 android에서 차트 라이브러리 중 제일 많이 사용되고 있다는 MPAndroidChart 차트를 구현해 보았다. Philipp Jahoda라는 개발자가 만든 차트 라이브러리다. 먼저, gradle에 라이브러리를 추가하고 repositories { maven { url 'https://jitpack.io' } } dependencies { implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0' } 차트를 추가할 Layout에 차트 Component를 추가해준다. 다음으로 java코드에서 해당 차트의 설정 및 데이터를 넣어 차트를 완성해 준다. LineChart chart = (LineChart)findViewById(R.id.chart); ArrayList.. 2021. 10. 22.
728x90