这期内容当中小编将会给大家带来有关Android中怎么利用Activity实现滑动返回,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。
Android 滑动返回Activity的实现代码
package com.example.wyj.cainiaoshopping.activity;import android.support.annotation.Nullable;import android.support.v7.app.AppCompatActivity;import android.os.Bundle;import com.example.wyj.cainiaoshopping.R;import me.imid.swipebacklayout.lib.SwipeBackLayout;import me.imid.swipebacklayout.lib.app.SwipeBackActivity;public class SwiftActivity extends SwipeBackActivity { private SwipeBackLayout mSwipeBackLayout; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_swift); mSwipeBackLayout = getSwipeBackLayout(); int edgeFlag = SwipeBackLayout.EDGE_LEFT; mSwipeBackLayout.setEdgeTrackingEnabled(edgeFlag); // saveTrackingMode(edgeFlag); }}
绑定远程仓库
compile 'me.imid.swipebacklayout.lib:library:1.0.0'
另外Activity的主题也要设置
<item name="Android:windowIsTranslucent">true</item>
上述就是小编为大家分享的Android中怎么利用Activity实现滑动返回了,如果刚好有类似的疑惑,不妨参照上述分析进行理解。如果想知道更多相关知识,欢迎关注编程网行业资讯频道。