রবিবার, ২১ জুলাই, ২০১৩

android xml - Refrencing a selector drawable from a style results blank imagebutton

I want to have a ImageButtons changing the image based on its state. (same as "like" button in nine gag and facebook apps).

I have defined a style for each of them that references a selector as a drawable but when I run the program, images doesn't appear. Can you tell me what's wrong with this approach? (sorry for my bad English)

comment_actions_style in values folder:

    <style name="LikeStyle">         <item name="android:src">@drawable/like</item>     </style>      <style name="DislikeStyle">         <item name="android:src">@drawable/dislike_normal</item>     </style>      <style name="ReplyStyle">         <item name="android:src">@drawable/reply_normal</item>     </style>      <style name="ShareStyle">         <item name="android:src">@drawable/share</item>     </style> </resources> 

and like drawable in drawable folder: (other buttons are the same)

<selector xmlns:android="http://schemas.android.com/apk/res/android">      <item android:drawable="@drawable/like_clicked" android:state_pressed="true"/>  <!-- pressed -->     <item android:drawable="@drawable/like_focused" android:state_focused="true"/>  <!-- focused -->     <item android:drawable="@drawable/like_normal"/>  <!-- default -->  </selector> 

These buttons also inherit from a layout if that's matter.

Source: http://stackoverflow.com/questions/17751067/android-xml-refrencing-a-selector-drawable-from-a-style-results-blank-imagebut

George Ferris happy valentines day blue ivy carter meteorite lebron james NASA asteroid

0টি মন্তব্য:

একটি মন্তব্য পোস্ট করুন

এতে সদস্যতা মন্তব্যগুলি পোস্ট করুন [Atom]

<< হোম