본문 바로가기

android

[Android] Material Design Ripple Animation Material Design을 진행 하는동안에 Android 에서 기본적으로 Click Animation을 지원해주는 View가 있는 반면에,그렇게 되지 않는 View 일 경우 해당 Animation을 만들어야만 합니다.이때 사용할만한 좋은 Library가 있어서 공유하고자 합니다. https://github.com/traex/RippleEffect 아래와 같이 표현하고자 하는 View나 Layout을 감싸주기만 하면 됩니다.IntegrationThe lib is available on Maven Central, you can find it with Gradle, pleasedependencies { compile 'com.github.traex.rippleeffect:library:1.3' } Usag.. 더보기
[Android] Font Library 디폴트 폰트를 바꾸기에 좋은 Library가 있어 공유하고자 합니다. https://github.com/tsengvn/typekit 1. main/assets 폴더 를 만든 후, 해당 폴더에 ttf나 otf 같은 폰트 파일을 복사 합니다. Typekit is a library that help you quick change default font of your android application. You don't need to add any custom view or tag to your current xml layout file. You make a quick config in your application class and change the font that you need specific for.. 더보기
[Android] NavigationView 커스텀화 NavigationView를 커스텀화 하기에 좋은 설명이 있어서 공유하고자 글을 씁니다. itemBackground, itemIconTint and itemTextColor are simple xml-attributes that can be set, though you have to use a custom prefix instead of the android: one.Example So if you wan't to customize the color of the text (e.g. pink when unchecked and teal when checked) you should use a ColorStateList.ExampleCreate a new *.xml file in /res/color - let'.. 더보기
[Android] TextView에 HTML 코드를 넣을 때 TextView에 HTML 태그를 넣을 수 있습니다. 아래와 같은 태그들을 사용 되는 되요. http://commonsware.com/blog/Android/2010/05/26/html-tags-supported-by-textview.html간편하게 아래 소스 형태로 TextView에 넣으시면 문제 없이 태그가 적용이 되는 것을 확인 할 수 있습니다.SpannableString spanText = new SpannableString(Html.fromHtml(htmlText)); 하지만!!span 태그를 이용하여 Color를 넣고자 할 경우가 있습니다.이럴 경우에는 아래와 같이 font 태그로 replace 시켜 주세요. String htmlText = txt.replace("span style=\"col.. 더보기
[Android] 강제적으로 Toolbar arrow 변경 Toolbar arrow가 AppbarLayout에 포함 되지 않거나 단독으로 쓰고자 할 경우,검은색으로 고정되어 버리는 경우가 있다. 이럴 경우, 강제적으로 arrow를 바꿔줄 수 있는데 아래 소스 같이 하면 된다.if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) getSupportActionBar().setHomeAsUpIndicator(getResources().getDrawable(R.drawable.abc_ic_ab_back_mtrl_am_alpha, null)); else getSupportActionBar().setHomeAsUpIndicator(getResources().getDrawable(R.drawable.abc_ic_ab_bac.. 더보기
[Android] ResizableImageView ImageView 에서 width를 화면으로 가득 채우고, 해당 Image에 따라 Height를 조절하고자 할 경우,ImageView의 scaleType만으론 표현이 불가능하다. 이럴 경우 아래와 같이 ImageView를 커스텀화 해서 사용하자. public class ResizableImageView extends ImageView { public ResizableImageView(Context context, AttributeSet attrs) { super(context, attrs); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec){ Drawable d = getDrawable(); if(d!=nul.. 더보기
[Android] GifView Local Gif 파일을 실행하는데 좋은 라이브러리가 있어서 공유하고자 합니다. https://github.com/koral--/android-gif-drawable-eclipse-sample try { GifDrawable gifDrawable = new GifDrawable(getResources(), R.drawable.giffile); mEmoticon.setImageDrawable(gifDrawable); } catch (Resources.NotFoundException e) { // TODO Auto-generated catch block if (RingQConfig.DEBUG) e.printStackTrace(); } catch (IOException e) { // TODO Auto-gene.. 더보기
[Android] ViewPager + SwipeRefreshLayout ViewPager와 SwipeRefreshLayout을 같이 사용할 경우, 서로 스크롤이 엉켜 ViewPager의 스크롤이 엉성하게 된다. 이럴 경우 iOS 같이 Horizontal일 경우에 SwipeRefreshLayout을 Disable을 시키고,Vertical 일 경우 Enable을 시키는 방식을 이용하면 된다. 1. Horizontal 인지 파악하는 Detector를 하나 만들어 둔다.public static class XScrollDetector extends GestureDetector.SimpleOnGestureListener { @Override public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float di.. 더보기