Hi I'm trying to make my linear layout work like button. I mean I'm trying to change its background color when the state is changed. I used selector to solve it, but it didn't work.
I looked for solutions and all they say was add clickable attribute. I've already done that.
My LinearLayout contains two LinearLayout which contains 9 TextViews each. They fill my LinearLayout fully.
What I thought of was that its child is absorbing the click event and my LinearLayout doesn't change its state to pressed.
So I put clickable and focusalbe attribute to false on every child of my LinearLayout.
However, it's still same.
Here's my code.
This is the selector jbbtn.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_enabled="true" android:state_pressed="true"
android:drawable="@drawable/jbbtn_pressed"/>
<item android:state_enabled="true"
android:drawable="@drawable/jbstyle_transparent"/>
<item android:state_enabled="false" android:drawable="@drawable/jbbtn_disabled"/>
</selector>
And This is My LinearLayout
<LinearLayout
android:id="@+id/llCurrents"
android:background="@drawable/jbbtn"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignTop="@+id/llTimer"
android:layout_below="@id/btnMenu"
android:layout_marginRight="3sp"
android:clickable="true"
android:focusable="true"
android:orientation="horizontal"
android:padding="3sp" >
~~~~~~
</LinearLayout>