selector - How to make imagebutton and textview to be clicked together in android? -


There are ImageButton and TextViews within my relative layout. I want to change my colors to blue when they are pressed and when they When it is released then it turns them white again. I need to do the same to both of them, it does not matter which of them I am. And I want them to activate the same action, for example a toast that will be shown on the screen.

I tried to do this with selectors and duplicatepanrent and many other options. Can anyone give me a simple example of how to do this?

Update:

  & lt; Selector xmlns: android = "http: /sschemas.android.com/apk/res/android"> & Lt; Item Android: Dragon = "@ Drable / Trash-Pressed" Android: state_pressed = "true" /> & Lt; Item Android: Dragon = "@ Drauble / Trash-Debad" Android: state_focused = "true" /> & Lt; Item Android: Dragon = "@ Drable / Trash" /> & Lt; / Selector & gt; & Lt; Selector xmlns: Android = "http://schemas.android.com/apk/res/android" & gt; & Lt; Item Android: state_pressed = "true" android: color = "# 33B5E5" /> & Lt; Item Android: state_focused = "true" android: color = "# 33B5E5" /> & Lt; Item Android: color = "# ffffff" /> & Lt; / Selector & gt; Android: layout_height = "wrap_content" android: layout_weight = "1"   

and this is the layout

    

When I click on Layout, the text selector and button are active, but the click event is not done when I click on the button, the selector does not work but the click event works

You can set selectors to apply the relative layout directly and for the same and make sure That you include android: clickable = "true" in your relational layout.

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -