본문 바로가기

Click

[Android] OnTouchListener에서 SingleTap 활용 하기 OnClickListener라는 좋은 리스너가 안드로이드에는 있지만,RecyclerView나 ChildView가 있는 경우에 OnClickListener가 먹히지 않는 경우가 있다. 이럴 경우, setOnTouchListener를 이용하는데 초창기에는 일일이 범위와 위치, 시간을 가지고 Click인지 체크하였지만GestureDector가 나온 이후로 이런 고민은 빠이빠이 됐다. ...gestureDetector = new GestureDetector(getActivity(), new SingleTapConfirm()); mCastContainer.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, .. 더보기
[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.. 더보기
[Andoird] Button 클릭 시, textColor 변경 text_selector.xml layout.xml 위와 같이 하면 적용 된다. Java 단에서 하고자 한다면 아래 소스를 참고 하세요. 예) /res/color/selector_text.xml123456 ;버튼이 xml layout 에 있는 경우는 그냥 android:textColor=”@color/selector_text.html” 로 지정해주면 되지만,만약 java 안에서 프로그램적으로 세팅해 주는 경우는 다음과 같은 코드를 써야 한다.123btnTest.setTextColor( getResources().getColorStateList(R.color.selector_text));이렇게 안 하고 그냥 getColor() 를 사용하면 버튼 터치 시 색 변화가 없다.출처 : https://chrisjh.. 더보기