如何在Android中使用onhover [英] How to use onhover in Android
问题描述
我想在Android中悬停功能的使用。但是,我是新来的Android,所以我不能够使用它。
I want to use on hover functionality in Android. But I am new to Android so I am not able to use it.
下面是我的main.xml文件。
Below is my 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>
现在我想要什么,当用户将鼠标悬停在内部相对布局做的是改变的 RelativeLayout的
和的TextView 颜色code>。所以,可以请建议我怎么能实现呢?
Now what I want to do when the user hovers on the inner relative layout is to change the color of the RelativeLayout
and the TextView
. So can please suggest me how could I implement this?
推荐答案
您已经有一个接受的回答你的问题,我还是想和大家分享了 onhover
表示鼠标移动到东西,这是这些国家之一:
You already have an accepted answer to your question , still I would like to share that onhover
means the mouse is over something and which is one of these states :
- pressed
- 选
- 关注
如果你想模拟聚焦或悬停状态然后像某些手机上有你应该使用一个手机触摸板或鼠标指针。触摸和键盘。
And if you want to simulate a focused or hover state then you should use a phone with touch pad or mouse pointer like some phones have. Touch as well as keypad.
这篇关于如何在Android中使用onhover的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!