gongwen / Swipebacklayout
SwipeBack is an android library that can finish a activity by using gesture.
Stars: ✭ 977
Programming Languages
java
68154 projects - #9 most used programming language
Projects that are alternatives of or similar to Swipebacklayout
Fillingbutton
🔥Replace typical onLongClickListener with this library!
Stars: ✭ 31 (-96.83%)
Mutual labels: library
Simple Sh Datascience
A collection of Bash scripts and Dockerfiles to install data science Tool, Lib and application
Stars: ✭ 32 (-96.72%)
Mutual labels: library
Cardviewlist
An elegant and responsive CardView like Android on iOS with Swift. Available horizontal and vertical scrolling with full animations and customizable.
Stars: ✭ 30 (-96.93%)
Mutual labels: library
Lib9wada
Wonderful library with lots of useful functions, algorithms and data structures in C, link it with -l9wada
Stars: ✭ 35 (-96.42%)
Mutual labels: library
Cs Pdf To Image
a simple library to convert pdf to image for .net
Stars: ✭ 31 (-96.83%)
Mutual labels: library
Contactlab Ui Components
DEPRECATED - Basic UI components for ContactLab UX design pattern library
Stars: ✭ 31 (-96.83%)
Mutual labels: library
Discpp
Simplified, but feature rich Discord API wrapper written in modern C++.
Stars: ✭ 31 (-96.83%)
Mutual labels: library
Datasafe
Datasafe - flexible and secure data storage and document sharing using cryptographic message syntax for data encryption
Stars: ✭ 32 (-96.72%)
Mutual labels: library
Lwc
⚡️ LWC - A Blazing Fast, Enterprise-Grade Web Components Foundation
Stars: ✭ 974 (-0.31%)
Mutual labels: library
Substitution Schedule Parser
Java library for parsing schools' substitution schedules. Supports multiple different systems mainly used in the German-speaking countries, including Untis, svPlan, and DAVINCI
Stars: ✭ 33 (-96.62%)
Mutual labels: library
SwipeBackLayout
SwipeBackLayout is an android library that can finish an activity by using gesture.
You can set the slide direction,such as FROM_LEFT,FROM_TOP,FROM_RIGHT and FROM_BOTTOM.
You can also set whether it can only slide from the edge.
Screenshots
Custom-Style | WeChat-Style |
---|---|
Sample Apk Download
Usage
Gradle
dependencies {
compile 'com.gongwen:swipeback:1.0.2'
}
Layout
<com.gw.swipeback.SwipeBackLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/swipeBackLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:directionMode="left"
app:isSwipeFromEdge="true"
app:maskAlpha="125"
app:swipeBackFactor="0.5">
<!-- SwipeBackLayout must contains only one direct child -->
</com.gw.swipeback.SwipeBackLayout>
<com.gw.swipeback.WxSwipeBackLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/swipeBackLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:directionMode="left"
app:isSwipeFromEdge="true"
app:maskAlpha="125"
app:swipeBackFactor="0.5">
<!-- WxSwipeBackLayout must contains only one direct child -->
</com.gw.swipeback.WxSwipeBackLayout>
Attention: If you are using WxSwipeBackLayout , you must call WxSwipeBackActivityManager.getInstance().init(this) to init it in Application. just like :
public class MainApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
WxSwipeBackActivityManager.getInstance().init(this);
}
}
Attributes
Attribute 属性 | Description 描述 |
---|---|
swipeBackFactor | set the factor of swipeback |
maskAlpha | set the background alpha at the beginning of swipeback |
directionMode | set the direction of swiping to finish |
isSwipeFromEdge | set whether it can only slide from the edge |
Code
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//SwipeBackLayout is included in the layout
setContentView(layoutId);
SwipeBackLayout mSwipeBackLayout = (SwipeBackLayout) findViewById(R.id.swipeBackLayout);
mSwipeBackLayout.setDirectionMode(SwipeBackLayout.FROM_LEFT);
mSwipeBackLayout.setMaskAlpha(125);
mSwipeBackLayout.setSwipeBackFactor(0.5f);
mSwipeBackLayout.setSwipeBackListener(new SwipeBackLayout.OnSwipeBackListener() {
@Override
public void onViewPositionChanged(View mView, float swipeBackFraction, float SWIPE_BACK_FACTOR) {
}
@Override
public void onViewSwipeFinished(View mView, boolean isEnd) {
}
});
}
or
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SwipeBackLayout mSwipeBackLayout = new SwipeBackLayout(this);
mSwipeBackLayout.addView(contentView);
setContentView(mSwipeBackLayout);
}
or
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//SwipeBackLayout is not included in the layout
setContentView(layoutId);
mSwipeBackLayout = new SwipeBackLayout(this);
mSwipeBackLayout.attachToActivity(this);
}
Theme
<style name="Theme.Swipe.Back.NoActionBar" parent="AppTheme">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
</style>
Support Views
SwipeBackLayout must contains only one direct child.
Such as:
- LinearLayout,RelativeLayout,FrameLayout,TableLayout etc.
- ScrollView,HorizontalScrollView,NestedScrollView etc.
- RecyclerView,the subClass of AbsListView(ListView etc.)
- ViewPager,WebView etc.
reference
ViewDragHelper详解
SwipeBack
BGASwipeBackLayout-Android
License
Copyright (C) 2017 [email protected]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
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].