Android 涟漪效应不';不能在listview中工作

Android 涟漪效应不';不能在listview中工作,android,android-layout,listview,xamarin.android,material-design,Android,Android Layout,Listview,Xamarin.android,Material Design,我在android中有一个可点击的列表视图,当我选择一个项目时,涟漪效应正在发挥作用,但我更改了我的样式文件,为涟漪效应工作按钮添加了这一行 <style name="InflorTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar"> //other things <item name="colorControlHighlight">@color/ripple_material

我在android中有一个可点击的列表视图,当我选择一个项目时,涟漪效应正在发挥作用,但我更改了我的样式文件,为涟漪效应工作按钮添加了这一行

<style name="InflorTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
         //other things
         <item name="colorControlHighlight">@color/ripple_material_dark</item>
    </style>

//其他事情
@颜色/波纹\u材质\u深色
添加这一行后,涟漪效应在按钮中起作用,但在listview中不起作用

有什么解决我问题的建议吗

这是我的stles文件:

<resources>
    <style name="InflorTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
        <item name="windowNoTitle">true</item>
        <item name="windowActionBar">false</item>
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="colorControlNormal">@color/colorAccent</item>
        <item name="colorControlHighlight">@color/ripple_material_dark</item>
    </style>
    <style name="InflorTheme" parent="InflorTheme.Base">
    </style>
    <style name="InflorTheme.Splash" parent="android:Theme">
        <item name="android:windowTranslucentStatus">true</item>
        <item name="android:windowBackground">@drawable/splash</item>
        <item name="android:windowNoTitle">true</item>
    </style>
</resources>

真的
假的
@颜色/原色
@颜色/原色暗
@颜色/颜色重音
@颜色/颜色重音
@颜色/波纹\u材质\u深色
真的
@可牵引/飞溅
真的
这是我的风格v-21:

<resources>
    <style name="InflorTheme" parent="InflorTheme.Base">
        <item name="android:windowDrawsSystemBarBackgrounds">true</item>
        <item name="android:windowContentTransitions">true</item>
        <item name="android:windowAllowEnterTransitionOverlap">true</item>
        <item name="android:windowAllowReturnTransitionOverlap">true</item>
        <item name="android:windowSharedElementEnterTransition">@android:transition/move</item>
        <item name="android:windowSharedElementExitTransition">@android:transition/move</item>
    </style>
</resources>

真的
真的
真的
真的
@android:过渡/移动
@android:过渡/移动
这是我的列表视图:

<Mvx.MvxListView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:id="@+id/listBoletins"
            android:footerDividersEnabled="true"
            android:headerDividersEnabled="true"
            android:dividerHeight="1dp"
            android:textFilterEnabled="false"
            android:layout_weight="1"
            android:background="?android:attr/selectableItemBackground"
            local:MvxBind="ItemsSource Boletins; ItemClick BoletimClickCommand"
            local:MvxItemTemplate="@layout/boletinsitem" />

为什么你要把这么简单的事情弄得这么复杂。你应该使用Listview或MvxListView的“appcompat Listview”接口,并尝试根据你的需求改变你的风格

如果您对自定义列表视图有自己的限制,那么您应该这样尝试。myview是您的布局视图

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.your_layout);

    View myView = findViewById(R.id.myView);
    int[] attrs = new int[]{R.attr.selectableItemBackground};
    TypedArray typedArray = getActivity().obtainStyledAttributes(attrs);
    int backgroundResource = typedArray.getResourceId(0, 0);
    myView.setBackgroundResource(backgroundResource);
}
并将这一行添加到xml文件中

<android:background="?android:attr/selectableItemBackground">

将其添加到您正在适配器中呈现的项目中。
android:前台=“?attr/selectableItemBackground”
android:clickable=“true”
在您看来

简单到

<ListView
    ...
    android:drawSelectorOnTop="true"/>


将在列表视图上启用连锁反应。

我必须在哪里添加?在ListView还是在layout?嘿,我已经更新了我的答案。抱歉,回答不完整。得到了预期结果,thanx@Tasneem是的,没有