본문 바로가기

disable

[Android] Viewpager swipe disable ViewPager에 Touch로 인한 Page 이동을 막고자 할 때 아래와 같이 Custom한 ViewPager를 사용 하세요. package com.namuon.ringq.widget.viewpager; import android.content.Context; import android.support.v4.view.MotionEventCompat; import android.support.v4.view.ViewPager; import android.util.AttributeSet; import android.view.MotionEvent; public class SwipeViewPager extends ViewPager { private boolean enabled; public SwipeViewPag.. 더보기
[Android] RatingBar touch disable RatingBar를 그냥 사용하게 되면, 기본적으로 사용자가 터치시 Rating이 변경되어 버린다. Rating을 변경 시키지 않고 유지할려면 아래와 같이 XML에 한줄만 추가해주면 된다. isIndicator를 true로 해주면 이 Rating은 그냥 보여주기 용으로 사용하겠다는 의미이다. 참고하세요. 더보기
[Android] AppbarLayout 과 RecyclerView ChildView AppbarLayout과 RecycerView만 연동을 할 때는 스크롤이 문제 없이 잘 된다. 하지만, 혹시 RecyclerView안에 RecyclerView를 넣을 경우 RecyclerView 안에 있는 RecyclerView를 스크롤 하면 AppbarLayout이 움직이지 않는 현상이 발생 하기도 합니다. 이럴 경우, Child RecyclerView의 Scroll를 막아주면 됩니다. 방법은 두가지가 있습니다. 1. setNestedScrollingEnabled 함수에 false 값을 넘깁니다.mRecycleView.setNestedScrollingEnabled(false); 2. LayoutManager를 커스터마이징 합니다. public class CustomLinearLayoutManager e.. 더보기
[Android] EditText 자동 포커스 제거 화면이 실행 되면 초반에 EditText에 자동 포커스가 되죠. 이부분을 제거하고 싶으실 경우 아래와 같이 해보세요. 아래 두줄을 EditText 에 넣는게 아니라 그걸 감싸고 있는 LinearLayout에 넣어주세요.그럼 포커스가 LinearLayout으로 가게 됩니다. android:focusable="true" android:focusableInTouchMode="true" 참고하세요. http://stackoverflow.com/questions/1555109/stop-edittext-from-gaining-focus-at-activity-startup 더보기
[Android] DrawerLayout Lock UnLock DrawerLayout을 Java 소스단에서 Swiping 시, Open이 안되도록 하고 싶을 경우 아래와 같이 설정하면 된다. mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED); 이럴 경우, 다시 UnLock 시키고 싶을 때는mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED); 위와 같이 하면 된다. Lock 상태에서 DrawerLayout을 강제로 Open 시키고 싶을 경우mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_OPEN); 이렇게 사용 하면 된다. 참 쉽죠잉~~~ 예를 들어 특정 Fragmen.. 더보기