내장 위젯을 수정하여 커스텀 위젯을 만들어야 할것 같은데.. 디자인 바꾸는건 어떻게 해야 할지를 모르겠습니다.
지금 구현하려는게..
라디오버튼처럼 그룹안에 있는 버튼들이 배타적으로 클릭이 되지만 동그란 클릭 이미지가 아니라..
선택 안된 상태일때 이미지1 , 선택된 상태일때 이미지2 를 보여주려고 합니다..
속성으로 구현이 가능한지를 모르겠네요.. ㅠㅠ
불가능하다면 커스텀 위젯으로 만들어야 할듯한데.. 기본 위젯의 디자인 xml부분이 어디에 있는지도 모르겠고..
수정이야 소스 보면 어떻게 하겠는데... 일단 기본위젯의 경우 xml 조차 어디있는지를 모르겠네요..
예를 들어 RadioButton 소스를 보니 왠지 디자인부분이 com.android.internal.R.attr.radioButtonStyle 이거인거 같은데..
이게 어딨는지....
안드로이드 풀소스를 받으시면 있습니다..;;
API에서 제공되는 위젯들은 대부분 플랫폼의 frameworks 에 있죠..
아래는 radioButton UI에 해당하는 style과 selector입니다.
참고하세요.
style부분
<style name="Widget.CompoundButton.RadioButton">
<item name="android:background">@android:drawable/btn_radio_label_background</item>
<item name="android:button">@android:drawable/btn_radio</item>
</style>
셀렉터 - btn_radio.xml
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true" android:state_window_focused="false"
android:drawable="@drawable/btn_radio_on" />
<item android:state_checked="false" android:state_window_focused="false"
android:drawable="@drawable/btn_radio_off" />
<item android:state_checked="true" android:state_pressed="true"
android:drawable="@drawable/btn_radio_on_pressed" />
<item android:state_checked="false" android:state_pressed="true"
android:drawable="@drawable/btn_radio_off_pressed" />
<item android:state_checked="true" android:state_focused="true"
android:drawable="@drawable/btn_radio_on_selected" />
<item android:state_checked="false" android:state_focused="true"
android:drawable="@drawable/btn_radio_off_selected" />
<item android:state_checked="false" android:drawable="@drawable/btn_radio_off" />
<item android:state_checked="true" android:drawable="@drawable/btn_radio_on" />
</selector>
RadioButton을 extends한 커스텀 RadioButton을 제작하시면 될듯한데요. 생성자부분을 오버라이드하셔서 구현하시면 되지 않을까합니다.
RadioButton의 소스를 보면 각생성자는 다음과 같습니다.
public RadioButton(Context context) {
this(context, null);
}
public RadioButton(Context context, AttributeSet attrs) {
this(context, attrs, com.android.internal.R.attr.radioButtonStyle);
}
public RadioButton(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
참고하셔서 원하시는 style을 만드신후 오버라이드해서 사용하시길 바라며, 내장 위젯이나 코드를 커스터 마이징 하시려고 한다면 안드로이드 풀소스는 꼭 받아서 직접 확인하시면서 작업 및 공부하시기 바랍니다.
안드로이드 풀소스는 인터넷 검색하시면 쉽게 구하실 수 있습니다.




라디오버튼의 UI는 selector로 되어 있습니다.
frameworks\base\core\res\res\drawable\btn_radio.xml 입니다.
말씀하시는 기능은 그냥 ImageView에 onClick이벤트 등록하여 키눌리면 setImage...() 로 컨트롤해주셔도 될듯 합니다만...