Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/kotlin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android ItemTouchHelper.SimpleCallback以编程方式滑动_Android_Kotlin - Fatal编程技术网

Android ItemTouchHelper.SimpleCallback以编程方式滑动

Android ItemTouchHelper.SimpleCallback以编程方式滑动,android,kotlin,Android,Kotlin,我正在使用android studios ItemTouchHelper.SimpleCallback来刷卡项目,我希望项目在长项目保留时被刷卡,有没有办法以编程方式刷卡项目?如何实现此功能 在res/anim文件夹中定义所需的动画 从左到右.xml <set xmlns:android="http://schemas.android.com/apk/res/android" android:shareInterpolator="false"> <translat

我正在使用android studios ItemTouchHelper.SimpleCallback来刷卡项目,我希望项目在长项目保留时被刷卡,有没有办法以编程方式刷卡项目?如何实现此功能

在res/anim文件夹中定义所需的动画

从左到右.xml

<set xmlns:android="http://schemas.android.com/apk/res/android"
     android:shareInterpolator="false">
  <translate android:fromXDelta="-100%" android:toXDelta="0%"
             android:fromYDelta="0%" android:toYDelta="0%"
             android:duration="700"/>
</set>

希望这有帮助<set xmlns:android="http://schemas.android.com/apk/res/android" android:shareInterpolator="false"> <translate android:fromXDelta="0%" android:toXDelta="100%" android:fromYDelta="0%" android:toYDelta="0%" android:duration="700" /> </set>
Animation slideAnim = AnimationUtils.loadAnimation(this, R.anim.right_to_left);
view.startAnimation(slideAnim); 
// Where 'view' is the view object which you want to swipe
// e.g: if its a list item you want to swipe, then maybe the 'view' can be the cardview that wraps the list item.