i want use on hover functionality in android. new android not able use it.
below main.xml file.
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:padding="5dip" > <!-- top company logo starts --> <imageview android:id="@+id/imglogo" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:layout_marginright="5dip" android:padding="3dip" android:src="@drawable/logo_demo" /> <!-- top company logo starts --> <!-- flight search box starts--> <relativelayout android:id="@+id/flight_relative" android:layout_width="match_parent" android:layout_height="70dp" android:layout_below="@+id/imglogo" android:layout_margintop="5dp" android:background="@drawable/gray_bg" android:gravity="center_vertical" > <imageview android:id="@+id/flight_list_image" android:layout_width="50dip" android:layout_height="50dip" android:layout_alignparentleft="true" android:layout_marginright="5dip" android:padding="3dip" android:src="@drawable/ic_launcher" /> <textview android:id="@+id/flight_content" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_aligntop="@+id/flight_list_image" android:layout_marginright="5dp" android:layout_margintop="10dp" android:layout_toleftof="@+id/flight_arrow" android:layout_torightof="@+id/flight_list_image" android:text="@string/flight_tittle" android:textcolor="#152b72" android:textstyle="bold" android:textsize="15dp" /> <textview android:id="@+id/content_flight" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/flight_content" android:layout_marginright="5dp" android:layout_toleftof="@+id/flight_arrow" android:layout_torightof="@+id/flight_list_image" android:text="@string/flight_content" android:textcolor="#2f2f2f" android:textsize="10dp" /> <imageview android:id="@+id/flight_arrow" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignbottom="@+id/flight_content" android:layout_alignparentright="true" android:src="@drawable/arrow" /> <!-- flight search box ends --> </relativelayout> <!-- approval box ends --> </relativelayout>
now want when user hovers on inner relative layout change color of relativelayout
, textview
. can please suggest me how implement this?
you can using selector
<item android:drawable="@drawable/bg_selected" android:state_selected="true"></item> <item android:drawable="@drawable/bg_hover" android:state_hovered="true"></item> <item android:drawable="@drawable/bg_normal"></item>
use android:state_hovered property
Comments
Post a Comment