我是Android开发的新手.我正在尝试开发适用于Android的短信应用.我成功阅读了收件箱和联系人并将其显示在一个ListView项目中.现在,我想要实现的是ListView每次点击或触摸或选择这些项目时都会产生连锁反应.我使用listSelector但似乎它不起作用.如果有人可以帮助我,下面是我的代码:
activity_main.xml中
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".MainActivity">
<ListView
android:id="@+id/msglist"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:drawSelectorOnTop="true"
android:listSelector="#777777" />
Run Code Online (Sandbox Code Playgroud)