Issue
I've got the following button:
<Button
android:id="@+id/searchCompaniesButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/company_icon"
android:drawablePadding="10dp"
android:drawableRight="@drawable/next_icon_big"
android:gravity="left|center_vertical"
android:paddingLeft="10dp"
android:backgroud="@drawable/transparent_button_selector"
android:paddingRight="10dp"
android:text="@string/searchCompanies" />
transparent_button_selector
is transparent_button_selector.xml
in /drawable-ldpi folder:
<?xml version="1.0" encoding="UTF-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/lightGrey"
android:state_pressed="true" />
<item android:drawable="@color/veryLightGrey"
android:state_focused="true" />
<item android:drawable="@null" />
</selector>
Also I've got a colors.xml
:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="lightGrey">#3d3d3d</color>
<color name="veryLightGrey">#4d4d4d</color>
</resources>
But when I run my app, log will say:
'item' tag requires a 'drawable' attribute"
What the hell? I know there are few similar questions, but answers are not helpful. I tried:
- Restarting Eclipse
- Cleaning projects
- Running app at real device(crush)
Solution
Replace this:
<item android:drawable="@null" />
with:
<item android:drawable="@color/transparent" />
and add transparent color in your color file with code: #00000000
Answered By - user2520215
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.