【发布时间】:2015-06-24 07:12:10
【问题描述】:
我对新闻项目有双重涟漪效应(项目中心的涟漪效应和触摸点的第二次),这是我的问题的屏幕截图:
但这只会发生在第一个项目上,在其他项目中,连锁反应效果很好。我正在关注这个udacity project,我确实意识到他们有同样的问题。
这是我正在使用的资源:
drawable-v21/touch_selector.xml
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<ripple android:color="@color/grey" />
</item>
<item android:drawable="@color/light_blue" android:state_activated="true" />
<item android:drawable="@android:color/transparent" />
</selector>
row_item.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/touch_selector"
android:minHeight="?android:attr/listPreferredItemHeight"
android:orientation="horizontal">
...
</LinearLayout>
fragment_main.xml
...
<ListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="@null"
tools:listitem="@layout/row_item" />
...
如何解决按下项目的双重涟漪效应? (同样,这只是发生在第一个项目中,其他项目运行良好)。
这里是源代码:https://github.com/epool/SpotifyStreamer/tree/stage-2
【问题讨论】:
-
该错误必须在代码中的其他位置。此外,还需要更多细节。例如,它是列表中的第一个项目,还是第一个被按下的项目。您是否注册了两个重叠的 Fragment 或 Recyclerview?
-
@easycheese 是的,它是列表中的第一个项目,而不是第一个被按下的项目。该活动有两个片段,左侧片段是列表所在的位置,右侧片段是另一个具有相同问题的列表。我现在不在笔记本电脑上,但如果有必要,我可以稍后添加更多代码,代码与 udacity github 链接非常相似。
标签: android android-listview material-design android-selector rippledrawable