All Projects → 506954774 → AndroidCustomSlideToUnlockView

506954774 / AndroidCustomSlideToUnlockView

Licence: other
安卓自定义滑动解锁控件

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to AndroidCustomSlideToUnlockView

LockerScreen
Android lock screen,slide to unlock ! 安卓锁屏,上滑解锁,效果酷炫,值得拥有!
Stars: ✭ 81 (+97.56%)
Mutual labels:  slidetounlockview

AndroidCustomSlideToUnlockView

安卓自定义滑动解锁控件

添加依赖:

dependencies {
// your dependencies ...
compile 'com.linklink.views:slide_to_unlock_view:1.0.0'
}

效果图:

img

可以自定义的属性:

name="slideImageViewWidth" format="dimension" //滑块宽度
name="slideImageViewResId" format="reference"//滑块资源id
name="slideImageViewResIdAfter" format="reference"//滑动到右边时,滑块资源id
name="viewBackgroundResId" format="reference"//背景资源id
name="textHint" format="string"//文本内容
name="textSize" format="integer"/>//文本字号
name="textColorResId" format="color"//文本字色
name="slideThreshold" format="float"//滑动阈值,默认是0.5,当右滑距离不满整个控件宽度的0.5,就会回弹至左边

xml :

<com.qdong.slide_to_unlock_view.CustomSlideToUnlockView
android:id="@+id/slide_to_unlock"
android:layout_width="match_parent"
android:layout_height="50dp"
chuck:viewBackgroundResId="@drawable/shape_round_normal_green"
chuck:slideImageViewWidth="@dimen/slide_width"
chuck:slideImageViewResId="@mipmap/icon_slide"
chuck:slideImageViewResIdAfter="@mipmap/ic_launcher"
chuck:slideThreshold="0.5"
chuck:textSize="6"
chuck:textHint="@string/hint"
chuck:textColorResId="@color/colorWhite"
</com.qdong.slide_to_unlock_view.CustomSlideToUnlockView>

MainActivity.java :

package com.qdong.slidetounlockdemo;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;
import com.qdong.slide_to_unlock_view.CustomSlideToUnlockView;


public class MainActivity extends AppCompatActivity {

    private CustomSlideToUnlockView mCustomSlideToUnlockView;
    private TextView tv_text;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mCustomSlideToUnlockView= (com.qdong.slide_to_unlock_view.CustomSlideToUnlockView) findViewById(R.id.slide_to_unlock);
        tv_text= (TextView) findViewById(R.id.tv_text);

        CustomSlideToUnlockView.CallBack callBack=new CustomSlideToUnlockView.CallBack() {
            @Override
            public void onSlide(int distance) {
                tv_text.setText("slide distance:"+distance);
            }

            @Override
            public void onUnlocked() {
                tv_text.setText("onUnlocked");
            }
        };
        mCustomSlideToUnlockView.setmCallBack(callBack);
        findViewById(R.id.button).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                mCustomSlideToUnlockView.resetView();
            }
        });
    }
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].