How can I specify a border color for an ImageView when it has focus

by Roy » Tue, 04 Aug 2009 23:15:00 GMT

Sponsored Links
 You can create a xml file under res/drawable. For example: res/

Here is the content:
<?xml version="1.0" encoding="UTF-8"?>
<selector xmlns:android="" ;>
        <item android:state_pressed="true" android:drawable="@drawable/
shape_2" />
        <item android:state_focused="true" android:state_enabled="true"
android:drawable="@drawable/shape_5" />

Here is shape_2.xml
<shape xmlns:android="" ;>
    <solid android:color="#FF0000FF"/>
    <stroke android:width="4dp" android:color="#FFFFFFFF"
            android:dashWidth="1dp" android:dashGap="2dp" />
    <padding android:left="7dp" android:top="7dp"
            android:right="7dp" android:bottom="7dp" />
    <corners android:radius="4dp" />


Other Threads

1. Android Development Workshops

Hi, i'm a student of PEC University of Technology, Chandigarh. We are 
conducting a Technical fest VYOM in da last week of march. We would like to 
conduct some sort of beginner level android development workshops during the 
fest. If someone is interested or if someone can give some references, it 
would be great if you could get in touch. My number is 09501461363.
website of fest -


2. Custom view in an App Widget


Am I correct in assuming that I can't use a custom view (a specialisation of 
View) in an App Widget? This guide: seems to 
suggest that this is the case.

:.:: mattias


3. another Android 3.0 question

4. For getting Adhoc package in Android

5. Maintaining a free and paid version & maybe other version

6. "Finish" Activity from Dialog.. Not finishing

7. im building a new device