ToggleButton に画像をつける

2011/07/07

画像ファイルの用意

まず、toggle_button_on.png、toggle_button_off.png ファイルをそれぞれ作成し、drawable に入れる。

xml ファイルの定義

drawable/toggle_button.xml を作成し、state_checked をそれぞれ設定する。




    
    

layout の設定

layout xmlファイルで ToggleButton の background に toggle_button.xml を設定する。