검색결과 리스트
글
Checkbox 이미지 활용하기
체크박스를 예쁘게 또는 기능 적으로 이미지의 힘을 빌려야 할떄가 있다
특히 3.0 이하에서는 더욱더 그렇다
얼릉 4.0 이하는 사라져야 하는데...
// layout
<CheckBox android:id="@+id/cchkbox" android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentLeft="true" android:layout_marginLeft="3dp"
android:padding="10dp"
android:focusable="false" android:clickable="false" android:button="@drawable/checkbox_sel" />
// drawable/checkbox_sel.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="false" android:drawable="@drawable/checkbox_dis" />
<item android:state_checked="true" android:drawable="@drawable/checkbox_ena" />
<item android:drawable="@drawable/checkbox_dis" />
</selector>
// JAVA
CheckBox ivChk = (CheckBox) findViewById(R.id.cchkbox);
ivChk.setChecked(true); // @drawable/checkbox_ena 이 녀석이 활성화 될거임(체크된 상태)
ivChk.setChecked(false); // @drawable/checkbox_dis 이 녀석이 활성화 될거임(체크되지 않은 상태)
'안드로이드 > android' 카테고리의 다른 글
액션 텝 메뉴 옵션메뉴가 하단에 펼치지게 하기 (0) | 2013.06.25 |
---|---|
android action bar swipe fragment listview setonitemclicklistener not working (1) | 2013.05.19 |
android:launchMode singleTop과 singleTask 의 차이점 (0) | 2013.05.08 |
위젯 사이즈 (0) | 2013.04.16 |
webview 클립보드 (Copy & paste) 에 내용 넣기 (0) | 2013.04.05 |