微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

komi-slider 使用方法使用项目 Android页面滑动控件

程序名称:komi-slider 使用方法使用项目

授权协议: Apache

操作系统: 跨平台

开发语言: Java

komi-slider 使用方法使用项目 介绍

slider重在让特定的页面具备滑动功能操作。

slider在此版本只需通过简单的继承、xml布局或者直接将上面3种类型对象通过SliderUtils类即可具备滑动功能

使用方法

1.目前支持activity、fragment、dialogfragment、dialog、view的滑动

2.通过如下简单操作,即可让页面具备滑动功能

public class SampleActivity extends Activity
{
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_slider);
        SliderUtils.attachActivity(this, mConfig);
    }
}

亦或通过简单的继承:

public class ExtendsActivity extends SliderActivity {
}

或者是直接通过xml布局,就可以让子View具备滑动功能

 <com.komi.slider.Slider
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        xmlns:slider="http://schemas.android.com/apk/res-auto"
        android:id="@+id/xml_slider_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        slider:edgeOnly="false"
        slider:position="all">

     <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:text="I CAN SLIDE Now!"
        android:textSize="23sp" />

        </com.komi.slider.Slider>

需要注意的是activity在manifest下配置theme需复写android:windowIsTranslucent,否则拉开的背景会全黑。

 <style name="ActivityTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <item name="android:windowIsTranslucent">true</item>
    </style>

使用项目

在项目的build.gradle文件添加库依赖

dependencies{
    compile 'com.komi.slider:slider:0.3.2'}

komi-slider 使用方法使用项目 官网

https://github.com/KobeKomi/Slider

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐