안드로이드 개발 질문/답변
(글 수 45,052)
seekbar view 를 터치 이벤트를 막기위해서 setfocus(false) 등등의 여러가지 방법을 써봤지만
결국 setenable(false)밖에 방법이 없었습니다. 그런데 문제는 setenable(false)를 하게 되면 기존의 seekbar 이미지가 어둡게 변하게 됩니다.
이를 막을 수 있는 방법이 있나요?
아시는 분 있으시면 알려주세요
selector 이용해서 android:state_enabled="false" 이렇게 해서 color 나 drawable를 설정해봤지만 전혀 안 먹습니다.
결국 setenable(false)밖에 방법이 없었습니다. 그런데 문제는 setenable(false)를 하게 되면 기존의 seekbar 이미지가 어둡게 변하게 됩니다.
이를 막을 수 있는 방법이 있나요?
아시는 분 있으시면 알려주세요
selector 이용해서 android:state_enabled="false" 이렇게 해서 color 나 drawable를 설정해봤지만 전혀 안 먹습니다.
2010.11.15 11:17:19
mTelText = (EditText) findViewById(R.id.tel_number);
mTelText.setEnabled(false);
mTelText.setBackgroundColor(Color.WHITE);
요렇게 하니까 되네요?
클릭하니까 키보드가 올라오긴 하네요 ^^:
mTelText.setEnabled(false);
mTelText.setBackgroundColor(Color.WHITE);
요렇게 하니까 되네요?
클릭하니까 키보드가 올라오긴 하네요 ^^:
2012.11.13 13:58:40
public class CustomSeekBar extends SeekBar{
//sungho0459.blog.me
//setEnabled(false) 속성을 줬을때 색깔이 변질되는걸 막고 싶어서 만든 Custom Seekbar
private boolean enabled = true;
public CustomSeekBar(Context context) {
super(context);
}
public CustomSeekBar(Context context, AttributeSet attrs) {
super(context, attrs);
}
public CustomSeekBar(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
if(!this.enabled){
return true;
}
return super.dispatchTouchEvent(event);
}
}
전 이렇게 만들어서 했습니다. ^^
setEnabled를 오버라이드 해서 super쪽으로 못 올라가게 막고.
touch에서 직접 컨트롤 하게 변경해준 코드입니다.
정확한 답은 아니겠지만 방법을 한 번 모색해보면,
seekbar의 디자인 속성을 갖는 xml을 가지고 커스텀하게 만들면 될지 모르겠네요. 또는 숨겨버리는 것은 어떨까요? ㅡㅡ;;
또는 움직임을 포착하는 메소드가 있으면, 움직일 때 위치를 고정할 수 있다면, 고정해 버리는 방법도 있을지 모르겠네요,