본문 바로가기

android

[Android] java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList.... 혹시, 프로젝트를 진행하다가 Jni library를 추가 하거나, 빌드된 Library를 추가 했을 경우 아래와 같은 에러가 발생할 수도 있다. java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/package-1/base.apk"],nativeLibraryDirectories=[/data/app/package-1/lib/arm64, /data/app/package-1/base.apk!/lib/arm64-v8a, /vendor/lib64, /system/lib64]]] couldn't find "libjni-armeabi.so" 위와 같은 에러 발생하면 아래와 같이 수정해보세요. ## 수.. 더보기
[Android] AppCompatDialog 사용하기 AppCompatDialog 를 사용하는 방법을 공유하고자 합니다. styles.xml 에 아래와 같이 Dialog Style를 커스텀화 할 수 있습니다. ## 윗부분에서 중요한 부분이 windowNoTiltle 속성을 true로 놓게 되면 Dialog에 Title을 설정 하더라도 보이지 않습니다. 참고 하세요. final AlertDialog.Builder builder; builder = new AlertDialog.Builder(activity, R.style.Dialog); builder.setTitle("여기는 타이틀"); builder.setMessage("여기는 메세지"); builder.setPositiveButton("OK", new DialogInterface.OnClickListene.. 더보기
[Android] Half ratingbar RatingBar라는 좋은 UI가 안드로이드에 있다. 이 RatingBar에 반만 색을 칠하거나 소숫점 단위로 표현하고자 할 경우,ratingbar xml을 아래와 같이 설정 하면 끝이다!! 중요한 부분은!! secondaryProgress 에 star_empty라는 비어있는 이미지를 넣는 것이다.참고 : http://stackoverflow.com/a/23887330/3534559 위 같이 커스텀된 RatingBar background를 아래와 같이 설정하면 된다. 더보기
[Android] Custom TextView not working gravity 혹시, CustomTextView를 만들었는데 Text가 gravity가 적용 되지 않을 경우!!!! 그냥 믿져야 본전으로 CustomTextView를 RelativeLayout으로 감싸보세요. (아니면 LinearLayout) android bug로 비슷한 경우가 몇번 발생 한다고 합니다. 참고하세요. 참고 : http://stackoverflow.com/questions/21658826/textview-gravity-not-working-on-api-18-or-higher 더보기
[Android] CustomView에 Attribute 만들기 1. values 폴더에 attrs.xml 파일을 만든다.2. 아래와 같이 attrs.xml 에 코드를 추가한다. NewAttr로 strokeWidth와 strokeColor 라는 속성을 만드는 것이다. 3. layout xml 파일에 속성 값을 넣는다. (잘 안보이시겠지만, 진하게 되어 있는 부분만 추가하면 됩니다.) 4. CustomView에 속성 값을 가져 온다. public GroupTitleView(Context context, AttributeSet attrs) { super(context, attrs); strokeWidth = context.obtainStyledAttributes(attrs, R.styleable.NewAttr) .getDimensionPixelSize(R.styleabl.. 더보기
[Android] Make CustomView (TextView, OnMeasure) CustomView를 만들어 보고자 합니다.하고자 하는 것은 TextView Background 에 기본적으로 RoundRect 가 그려지도록 할 예정입니다. 여기서 필요한 기술이 두가지 입니다. 1. Background를 어떻게 그리지??2. CustomeView의 크기를 어떻게 조절하지??? 모든것을 설명해 드릴 수 없지만, 개발하는데 유용할 만한 내용은 될것이라 생각 됩니다. 먼저, Background에 이미지를 넣을때 아래와 같은 방법을 많이 씁니다. (전..그랬음.._) - FrameLayout으로 감싼 후, Background로 활용할 이미지를 ImageView에 먼저 그린 후 그 다음으로 위에 표현하고자 하는 View를 올린다. 단점 ) View의 크기가 고정 되어 있지 않으면 (예를 들어 .. 더보기
[Android] Get current fragment 현재 보여지고 있는 Fragment를 가지고 오고자 할 경우 아래 함수가 정말 유용하다. Activity에 Fragment를 넣을 시, replace나 add 함수를 통하여 특정 레이아웃에다가 설정을 하였을 것이다.ex>getSupportFragmentManager() .beginTransaction() .add(R.id.fragment_container, fragment) .commit(); 이럴 경우 아래 함수를 통하여 현재 Fragment를 가지고 올 수 있다. Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.fragment_container); R.id.fragment_container 라는 레이아웃에 포함된 Fragme.. 더보기
[Android] 강제로 AppbarLayout 열기 혹시 특정 시점에 AppbarLayout을 강제로 열고자할 경우 아래글을 읽어보세요. Using support libs v23 you can call appBarLayout.setExpanded(true/false) http://stackoverflow.com/a/32137264/3534559 setExpaned(true)를 주면 자동으로 AppbarLayout이 열립니다. 또 다른 오바라이딩 함수로 setExpaned(boolean expaned, boolean animate)로 되어 있습니다.animating을 할지 결정이 가능합니다. 디폴트는 animate가 true로 되어 있습니다.참고하세요. 더보기