Setting image source for ToggleButton
<p>I have a 30px x 30px png file that i would like to use as an android:src rather than an android:background. By using it as the background, and mentioning "wrap_content" for both the height and the width, the final result looks more like a 45px x 45 px.</p>

<p>Ideally, what i need is a mix of ImageButton and ToggleButton. I would like to have the feature of setting an android:src of ImageButton and the feature of toggling where states are saved automatically for me.</p>

<p>Any solution or workaround?</p>

<p>TIA.</p>

<p>Hi, It does not seem to help creating another style. The src still appears much bigger that it's original 30px x 30px. </p>

<p>In main.xml:</p>

<pre><code>&lt;ToggleButton android:id="@+id/blah"
    style="@style/myToggle"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"&gt;
&lt;/ToggleButton&gt;
</code></pre>

<p>In Styles.xml</p>

<pre><code>&lt;style name="myToggle"&gt;
    &lt;item name="android:textOn"&gt;""&lt;/item&gt;
    &lt;item name="android:textOff"&gt;""&lt;/item&gt;
    &lt;item name="android:disabledAlpha"&gt;?android:attr/disabledAlpha&lt;/item&gt;
    &lt;item name="android:background"&gt;@drawable/my_btn_toggle_bg&lt;/item&gt;
&lt;/style&gt;
</code></pre>

<p>In my_btn_toggle_bg.xml</p>

<pre><code>&lt;layer-list xmlns:android="http://schemas.android.com/apk/res/android"&gt;
    &lt;item android:id="@+id/myBackground" android:drawable="@android:drawable/btn_default_small" /&gt;
    &lt;item android:id="@+id/myToggle" android:drawable="@drawable/my_btn_toggle" /&gt;
&lt;/layer-list&gt;
</code></pre>

<p>In my_btn_toggle.xml</p>

<pre><code>&lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt;
    &lt;item android:state_checked="false" android:drawable="@drawable/pausebutton" /&gt;
    &lt;item android:state_checked="true" android:drawable="@drawable/playbutton" /&gt;
&lt;/selector&gt;
</code></pre>

<p>playbutton.png and pausebutton.png are 30px x 30px each. But they appear much bigger when i see it laid out on the device</p>
