EasyFlipView
介绍:
一个可以轻易实现视图翻转的库,你只需提供正反两面的视图就可以了。
运行效果:
使用说明:
build.gradle
dependencies {
compile 'com.wajahatkarim3.EasyFlipView:EasyFlipView:1.0.0'
}
XML
<com.wajahatkarim3.easyflipview.EasyFlipView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:flipOnTouch="true"
app:flipEnabled="true"
app:flipDuration="400">
<!-- Back Layout Goes Here -->
<include layout="@layout/flash_card_layout_back"/>
<!-- Front Layout Goes Here -->
<include layout="@layout/flash_card_layout_front"/>
</com.wajahatkarim3.easyflipview.EasyFlipView>
属性
<declare-styleable name="easy_flip_view">
<!-- Whether card should be flipped on touch or not (Default is true) -->
<attr name="flipOnTouch" format="boolean"/>
<!-- The duration of flip animation in milliseconds (Default is 400 ms) -->
<attr name="flipDuration" format="integer"/>
<!-- If this is set to false, then it won't flip ever (Default is true) -->
<attr name="flipEnabled" format="boolean"/>
</declare-styleable>
java代码
// Flips the view with animation
mYourFlipView.flipTheView();
// Sets and Gets the Flip Animation Duration in milliseconds (Default is 400 ms)
mYourFlipView.setFlipDuration(1000);
int dur = mYourFlipView.getFlipDuration();
// Sets and gets the flip enable status (Default is true)
mYourFlipView.setFlipEnabled(false);
boolean flipStatus = mYourFlipView.isFlipEnabled();
// Sets and gets the flip on touch status (Default is true)
mYourFlipView.setFlipOntouch(false);
boolean flipTouchStatus = mYourFlipView.isFlipOnTouch();
已下载
0