SlideView一个滑动效果库
来源:互联网 发布:矩阵的零次方等于一吗 编辑:程序博客网 时间:2024/06/15 22:27
先上效果图:
1.建立Gradle
allprojects { repositories { jcenter() maven { url "https://jitpack.io" } }}dependencies { compile 'com.github.MAXDeliveryNG:slideview:1.0.0'}
2.xml:
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" > <ng.max.slideview.SlideView android:id="@+id/slider1" android:layout_marginTop="5dp" android:layout_width="match_parent" android:layout_height="wrap_content" app:buttonBackgroundColor="#fff" app:buttonImage="@drawable/ic_chevron_double_right_pink" app:slideBackgroundColor="@color/colorAccent" app:slideText="Accept"/> <ng.max.slideview.SlideView android:id="@+id/slider2" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="15dp" android:layout_marginTop="15dp" app:buttonBackgroundColor="@android:color/white" app:buttonImage="@drawable/ic_chevron_double_right_purple" app:reverseSlide="true" app:slideBackgroundColor="@color/colorPrimary" app:slideText="Cancel"/> <ng.max.slideview.SlideView android:id="@+id/slider3" android:layout_width="match_parent" android:layout_height="wrap_content" app:buttonBackgroundColor="@color/colorAccent" app:buttonImage="@drawable/ic_chevron_double_right_white_24dp" app:slideBackgroundColor="@android:color/white" app:slideText="Accept" app:slideTextColor="@color/colorAccent" app:strokeColor="@color/colorAccent"/> <ng.max.slideview.SlideView android:id="@+id/slider4" android:layout_width="match_parent" android:layout_height="wrap_content" app:reverseSlide="true" app:buttonBackgroundColor="@color/colorPrimary" app:buttonImage="@drawable/ic_chevron_double_right_white_24dp" app:slideBackgroundColor="@android:color/white" app:slideText="Reverse" app:slideTextColor="@color/colorPrimary" app:strokeColor="@color/colorPrimary" android:layout_marginBottom="15dp" android:layout_marginTop="15dp"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Slide to disable" android:layout_marginTop="25dp" android:textSize="20sp" android:layout_gravity="center_horizontal" android:textColor="@color/colorPrimary"/> <ng.max.slideview.SlideView android:id="@+id/slider5" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="15dp" android:layout_marginTop="15dp" app:buttonBackgroundColor="@android:color/white" app:buttonImage="@drawable/ic_settings_purple" app:slideBackgroundColor="@color/slide_button_bg_selector" app:slideText="Enabled" app:buttonImageDisabled="@drawable/ic_settings_grey600_24dp"/></LinearLayout>
3.使用,MainActivity:
public class MainActivity extends AppCompatActivity { private SlideView slideView1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); slideView1 = (SlideView) findViewById(R.id.slider1); slideView1.setOnSlideCompleteListener(new SlideView.OnSlideCompleteListener() { @Override public void onSlideComplete(SlideView slideView) { // 震动100毫秒,需要添加权限 Vibrator Vibrator vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); vibrator.vibrate(100); // 跳转下一个Activity startActivity(new Intent(MainActivity.this, SecondActivity.class)); } }); }}
4.属性信息:
5.GitHub地址:
https://github.com/MAXDeliveryNG/slideview
Demo下载
0 0
- SlideView一个滑动效果库
- SlideView 图片滑动(扩展/收缩)展示效果
- ViewFlow,一个滑动效果库
- slideview 侧滑时上下滚动 onitemclick和滑动的冲突 解决方法
- 一个简单图片滑动效果
- 一个简单的滑动门效果
- 一个简单的滑动门效果代码
- viewPager.setCurrentItem有一个动画滑动效果
- View的滑动及一个跟手滑动的效果
- 滑动效果
- 滑动效果
- 滑动效果
- Tab切换动画滑动效果的一个简单实现
- <Jquery>一个简单的切换与滑动效果
- Activity手势滑动返回前一个Activity效果实现
- 写了一个简单可以滑动的抽屉效果
- 一个实现抽屉滑动删除效果的listView
- 打造一个具有弹性滑动效果的TextView
- Java中httpClient中的三种超时设置小结(转)
- struct object 结构体分析
- centos图形化界面gnome-shell卡死的解决方法
- Rsyslog日志采集
- final关键字
- SlideView一个滑动效果库
- Appium 服务关键字
- js实现父子类集成的方法
- VS+QT没有PRO文件的问题之二(添加pri文件)
- apt-get update
- gcc 静态库和动态库的使用
- Spring MVC
- 常见存储介质介绍以及SD卡启动系统方法
- 找回过去之java8旧特性的接口默认方法