개발자료/Android(35)
-
JSON 키 존재, 값 존재 여부 체크
# JSON Object 생성 JSONObject obj = new JSONObject(); try { obj.put("key1", "value1"); obj.put("key2", null); } catch (JSONException e) { e.printStackTrace(); } # 키 존재 여부 체크 if(obj.has("key1")){ System.out.println("key1 has"); }else{ System.out.println("key1 not has"); } if(obj.has("key2")){ System.out.println("key2 has"); }else{ System.out.println("key2 not has"); } if(obj.has("key3")){ System.ou..
2020.07.22 -
HashMap 전체 참조(foreach) 방법 (Java)
HashMap 에 포함된 Key, Value 값을 모두 확인하는 방법 # 데이터 생성 HashMap map = new HashMap(); map.put("key1", "value1"); map.put("key2", "value2"); map.put("key3", "value3"); # 방법 1 Iterator keys = map.keySet().iterator(); while( keys.hasNext() ){ String strKey = keys.next(); String strValue = map.get(strKey); System.out.println( strKey +":"+ strValue ); } # 방법 2 for( Map.Entry entry : map.entrySet() ){ String s..
2020.07.21 -
TextView 줄간격(행간) 설정
# Layout XML에서 처리 - android:lineSpacingExtra 값을 이용해서 설정 # Java Code에서 처리 // setLineSpacing(add, mult) textView.setLineSpacing(0, 1.0f); add : 텍스트 줄간격을 add 만큼 더함 mult : 텍스트 줄간격을 mult 만큼 곱함
2020.07.15 -
[앱배포] PlayStore
## 이미지 # 인트로 mdpi: 360 x 640px hdpi: 480 x 800px xhdpi: 720 x 1280px xxhdpi: 1080 x 1920px xxxhdpi: 1440 x 2560px # ic_launcher.png : 런처 아이콘 mdpi : 48 x 48px hdpi : 72 x 72px xhdpi : 96 x 96px xxhdpi : 144 x 144px xxxhdpi : 192 x 192px # 액션바 아이콘 mdpi: 24 x 24px hdpi: 36 x 36px xhdpi: 48 x 48px xxhdpi: 72 x 72px xxxhdpi: 96 x 96px # Notification > Small Icon : 투명한 배경에 흰색 이미지가 올라간 PNG 파일 mdpi : 24..
2020.07.15 -
ImageView - scaleType
# scaleType 속성 android:scaleType="matrix" : 원본 크기 그대로 보여줌, 왼쪽상단 정렬 android:scaleType="center" : 원본 크기 그대로 보여줌, 가운데 정렬 android:scaleType="centerCrop" : View 영역에 공백이 있으면 채워서 보여줌, 비율유지 android:scaleType="centerInside" : View 영역을 벗어나면 맞춰서 보여줌, 비율유지 android:scaleType="fitStart" : View 영역에 맞게 보여줌, 왼쪽상단 정렬, 비율유지 android:scaleType="fitCenter" : View 영역에 맞게 보여줌, 가운데 정렬, 비율유지 android:scaleType="fitEnd" : ..
2020.07.14 -
[오픈소스] glide
# Gradle repositories { google() jcenter() } dependencies { implementation 'com.github.bumptech.glide:glide:4.11.0' annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0' } # Maven com.github.bumptech.glide glide 4.11.0 com.github.bumptech.glide compiler 4.11.0 true # glide https://github.com/bumptech/glide bumptech/glide An image loading and caching library for Android focused on smoot..
2020.07.14