Fixed: "Android: Detecting focus/pressed color"
<p>I'm trying to detect the focus/pressed color for button and other elements.
This is needed because I'm developing new components and it's important that those look as part of platform.
Those colors are ORANGE on android sdk and GREEN on HTC SenseUI.
If I could detect that color my component will look as part of platform on both version.</p>

<p>Does anyone knows how to do this?</p>

<hr>

<p><em><strong>It's possible to create "selector" which uses custom image for default state and platform default for focus/selection.</em></strong></p>

<p><strong>To do this follow the steps:</strong>
1) create xml file with selector in "res/drawable" (e.g. "red_button.xml"):</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt;

    &lt;item android:state_pressed="true"
        android:drawable="@android:drawable/btn_default" &gt;
    &lt;/item&gt;

    &lt;item android:state_focused="true"
        android:drawable="@android:drawable/btn_default" &gt;
    &lt;/item&gt;

    &lt;item 
        android:drawable="@drawable/btn_default_red" &gt;
    &lt;/item&gt;
&lt;/selector&gt;
</code></pre>

<p>2) from folder ".../android-sdk-mac/platforms/android-1.5/data/res/drawable/" take picture "btn_default_pressed.9.png" and change color as you like (I needed to change it to red and for this GIMP is enough).</p>

<p>3) place altered picture in "res/drawable" (e.g. with name "btn_default_red.9.png")</p>

<p>4) define button:</p>

<pre><code>&lt;Button
    android:id="@+id/info_button"
    android:layout_width="wrap_content" 
    android:layout_height="37dip"
    android:layout_marginTop="1dip"
    android:background="@drawable/red_button"
    android:text="[Info]" /&gt;
</code></pre>

<p>That's all.</p>

<p>This is result:
<img src="http://img200.imageshack.us/img200/1349/custombutton.png" alt="alt text"></p>
