Giter VIP home page Giter VIP logo

bgaswipebacklayout-android's Introduction

🏃BGASwipeBackLayout-Android🏃

强烈建议与 StatusBarUtil 结合着一起使用

常见问题与反馈

1.使用透明主题时,滑动返回看见了 Launcher

保证栈底 Activity 的主题是不透明的。例如 demo 中的首个 Activity 是 SplashActivity,进入主界面后 SplashActivity 就销毁了,此时 MainActivity 就是栈底 Activity,需保证 MainActivity 的主题不透明

2.使用非透明主题时,滑动返回结束时立即触摸界面应用程序崩溃

把该崩溃界面里比较特殊的 View 的 class 添加到集合中作为「BGASwipeBackHelper.init」的第2个参数,例如地图控件。目前在库中已经添加了 WebView 和 SurfaceView,不用再次添加这两个了

功能介绍

  • 通过修改 support-v4 包中 SlidingPaneLayout 的源码来实现滑动返回布局
  • 支持非透明主题滑动返回,不影响 Activity 生命周期
  • 动态设置滑动返回是否可用
  • 动态设置是否仅仅跟踪左侧边缘的滑动返回
  • 动态设置是否是微信滑动返回样式
  • 动态设置是否显示滑动返回的阴影效果
  • 支持全屏、横屏和竖屏

效果图与示例 apk

普通滑动返回样式 微信滑动返回样式
BGASwipeBackLayoutDemo BGASwipeBackLayoutDemo-WeChat
配合滑动删除列表一起使用 配合 RecycerView 一起使用
bgaswipebacklayout-swipe-delete bgaswipebacklayout-recycler-index

点击下载 BGASwipeBackLayoutDemo.apk 或扫描下面的二维码安装

BGASwipeBackLayoutDemo apk 文件二维码

1.添加 Gradle 依赖

  • maven { url 'https://jitpack.io' } 添加到 root build.gradle 的 repositories 中
  • 在 app build.gradle 中添加如下依赖,末尾的「latestVersion」指的是徽章 里的版本名称,请自行替换
implementation 'com.github.bingoogolapple:BGASwipeBackLayout-Android:latestVersion'
// 换成己工程里依赖的 support-v4 的版本
implementation 'androidx.legacy:legacy-support-v4:1.0.0'

2.必须在 Application 的 onCreate 方法中执行 BGASwipeBackHelper.init 来初始化滑动返回

public class App extends Application {

    @Override
    public void onCreate() {
        super.onCreate();

        /**
         * 必须在 Application 的 onCreate 方法中执行 BGASwipeBackHelper.init 来初始化滑动返回
         * 第一个参数:应用程序上下文
         * 第二个参数:如果发现滑动返回后立即触摸界面时应用崩溃,请把该界面里比较特殊的 View 的 class 添加到该集合中,目前在库中已经添加了 WebView 和 SurfaceView
         */
        BGASwipeBackHelper.init(this, null);
    }
}

3.将下面的代码拷贝到你自己的 BaseActivity 中,建议参考 demo 里的这个 BaseActivity 来设置界面跳转动画

public abstract class BaseActivity extends AppCompatActivity implements BGASwipeBackHelper.Delegate {
    protected BGASwipeBackHelper mSwipeBackHelper;
    protected Toolbar mToolbar;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        // 「必须在 Application 的 onCreate 方法中执行 BGASwipeBackHelper.init 来初始化滑动返回」
        // 在 super.onCreate(savedInstanceState) 之前调用该方法
        initSwipeBackFinish();
        super.onCreate(savedInstanceState);
    }

    /**
     * 初始化滑动返回。在 super.onCreate(savedInstanceState) 之前调用该方法
     */
    private void initSwipeBackFinish() {
        mSwipeBackHelper = new BGASwipeBackHelper(this, this);

        // 「必须在 Application 的 onCreate 方法中执行 BGASwipeBackHelper.init 来初始化滑动返回」
        // 下面几项可以不配置,这里只是为了讲述接口用法。

        // 设置滑动返回是否可用。默认值为 true
        mSwipeBackHelper.setSwipeBackEnable(true);
        // 设置是否仅仅跟踪左侧边缘的滑动返回。默认值为 true
        mSwipeBackHelper.setIsOnlyTrackingLeftEdge(true);
        // 设置是否是微信滑动返回样式。默认值为 true
        mSwipeBackHelper.setIsWeChatStyle(true);
        // 设置阴影资源 id。默认值为 R.drawable.bga_sbl_shadow
        mSwipeBackHelper.setShadowResId(R.drawable.bga_sbl_shadow);
        // 设置是否显示滑动返回的阴影效果。默认值为 true
        mSwipeBackHelper.setIsNeedShowShadow(true);
        // 设置阴影区域的透明度是否根据滑动的距离渐变。默认值为 true
        mSwipeBackHelper.setIsShadowAlphaGradient(true);
        // 设置触发释放后自动滑动返回的阈值,默认值为 0.3f
        mSwipeBackHelper.setSwipeBackThreshold(0.3f);
        // 设置底部导航条是否悬浮在内容上,默认值为 false
        mSwipeBackHelper.setIsNavigationBarOverlap(false);
    }

    /**
     * 是否支持滑动返回。这里在父类中默认返回 true 来支持滑动返回,如果某个界面不想支持滑动返回则重写该方法返回 false 即可
     *
     * @return
     */
    @Override
    public boolean isSupportSwipeBack() {
        return true;
    }

    /**
     * 正在滑动返回
     *
     * @param slideOffset 从 0 到 1
     */
    @Override
    public void onSwipeBackLayoutSlide(float slideOffset) {
    }

    /**
     * 没达到滑动返回的阈值,取消滑动返回动作,回到默认状态
     */
    @Override
    public void onSwipeBackLayoutCancel() {
    }

    /**
     * 滑动返回执行完毕,销毁当前 Activity
     */
    @Override
    public void onSwipeBackLayoutExecuted() {
        mSwipeBackHelper.swipeBackward();
    }

    @Override
    public void onBackPressed() {
        // 正在滑动返回的时候取消返回按钮事件
        if (mSwipeBackHelper.isSliding()) {
            return;
        }
        mSwipeBackHelper.backward();
    }
}

4.强烈强烈强烈建议把 BGASwipeBackHelper 里的每个方法的注释看一遍,只看注释就好

demo 中用到的第三方库

  • StatusBarUtil A util for setting status bar style on Android App
  • BGABaseAdapter-Android 在 AdapterView 和 RecyclerView 中通用的 Adapter 和 ViewHolder。RecyclerView 支持 DataBinding 、多种 Item 类型、添加 Header 和 Footer。RecyclerView 竖直方向通用分割线 BGADivider,吸顶分类
  • BGAProgressBar-Android 带百分比数字的水平、圆形进度条
  • BGARefreshLayout-Android 多种下拉刷新效果、上拉加载更多、可配置自定义头部广告位
  • BGASwipeItemLayout-Android 类似 iOS 带弹簧效果的左右滑动控件,可作为 AbsListView 和 RecyclerView 的 item
  • 谷爹的 support 包

代码是最好的老师,更多详细用法请查看 demo🐾

关于我

个人主页 邮箱 BGA 系列开源库 QQ 群 GitHub 喵(专注于 GitHub 等一切与程序员有关的内容)
bingoogolapple.cn [email protected] BGA_CODE_CLUB GitHub喵

打赏支持

如果您觉得 BGA 系列开源库帮你节省了大量的开发时间,请扫描下方的二维码随意打赏,要是能打赏个 10.24 🐵就太👍了。您的支持将鼓励我继续创作:octocat:

如果您目前正打算购买通往墙外的梯子,可以使用我的邀请码「YFQ9Q3B」购买 Lantern,双方都赠送三个月的专业版使用时间:beers:

License

Copyright (C) 2012 The Android Open Source Project
Copyright 2016 bingoogolapple

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.

bgaswipebacklayout-android's People

Contributors

880634 avatar bingoogolapple avatar foolchen avatar limuyang2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bgaswipebacklayout-android's Issues

使用过场动画时上一个画面是白色

        Slide slide1 = new Slide();
        slide1.setSlideEdge(Gravity.BOTTOM);
        Slide slide2 = new Slide();
        slide2.setSlideEdge(Gravity.TOP);

        getWindow().setEnterTransition(slide1);
        getWindow().setExitTransition(slide1);
        getWindow().setReturnTransition(slide1);
        getWindow().setReenterTransition(slide1);  

1.ActivityA中添加的上述代码,从ActivityB滑动返回的时候是A白版
2.后续会fragment滑动返回吗?

demo 底部空白

您好,测试demo在htc e9pw手机上当隐藏虚拟按键后,则出现白色底,请问如何解决?

关于阴影

一个很不错的库,看了这么多,终于看见一个比较满意的了。只是滑动返回阴影效果有点重,如果可以自定义阴影深度就好了。

支持 Fragment 的滑动返回吗

现在的情况 是这样的的:
入口是 MainActivity -->Fragment A--->Fragment B --->Fragment C
然后 可以从 Fragment C 滑动返回 Fragment B 然后滑动返回 Fragmnet A 吗?

BGASwipeBackLayout中的mMoveState变量,导致关闭逻辑错误

BGASwipeBackLayout中的onPanelDragged方法里面部分代码导致右滑一部分之后再左滑,页面还是关闭了。引起问题的代码:
float curOffsetDelta = mSlideOffset - lastSlideOffset; if (mMoveState == MOVE_STATE_RIGHT) { if (curOffsetDelta < mLastOffsetDelta) { curOffsetDelta = mLastOffsetDelta; mSlideOffset = lastSlideOffset + curOffsetDelta; mSlideOffset += 0.05f; if (mSlideOffset > 1.0f) { mSlideOffset = 1.0f; } } else { mLastOffsetDelta = curOffsetDelta; } }
我在本地尝试去掉mLastOffsetDelta和mMoveState相关的逻辑处理,发现没有出问题。所以请问下,这部分的逻辑是不是应该去掉会好些。

popupwindow

activity中设置透明之后,如果里面包含一个popupwindow并且在pop显示的时候设置 getWindow().setAttributes(lp)透明度之后会看到上一个界面

呼唤国产手机导航栏白条、内容遮盖的朋友前来助攻

出现白条、遮盖,出现这个问题的根源在于厂家自己实现了navigationBar状态的管理,导致我们用系统的状态栏高度计算出问题,出问题的在oppo R7Plus。这款手机,导航条逻辑被厂商魔改过后,显示、隐藏、flag检测都出了问题,导致作者的代码在这款上面会出现白条

安卓翻了下源码,在5.0以上的机型,decoverView子View有个导航栏背景色View,ID叫navigationBarBackground;现在我有了解决办法,就是检测厂家自己定义的导航条View,我们自己做处理

8.0源码地址

已知oppo R9Plus、华为ALE-TL100、华为PLK-TL10H的 navigationBar的ID都叫navigationBarBackground

大家可以打开demo,然后把View的节点打印出来查看下
类似的魅族老款的flyme也可以这么做

底部出现空白区域的手机对应的 android.Build.MODEL

如果发现某些手机上底部出现空白区域,麻烦打印以下信息反馈到当前 Issue 中

android.Build.VERSION.SDK_INT

android.Build.MODEL

可以通过 BGASwipeBackManager.ignoreNavigationBarModels(Arrays.asList("底部出现空白区域的手机对应的 android.Build.MODEL")) 来临时解决该问题

目前已发现机型

  • Nexus 4
  • H60-L01
  • P7-L07
  • MT7-UL00
  • HUAWEI P7-L07
  • OPPO R7s
  • Xiaomi HM Note 1S

测试

啊大大撒旦三单

隐藏NavigationBar全屏的时候,底部白色

  • 设置View.SYSTEM_UI_FLAG_HIDE_NAVIGATION后,NavigationBar隐藏了,但还有白色区域。

  • 我目前解决方案是通过反射UIUtil拿到NO_NAVIGATION_BAR_MODEL_SET,添加mode白名单,onDestroy的时候还是通过反射移除mode白名单。

  • 希望能有更好的解决方案😃

底部白色

SDK_INT:19
MODEL:P7-L07
品牌:HUAWEI

华为 Ascend P7

滑动返回后应用崩溃,该界面里有SwipeMenuRecyclerView

SwipeMenuRecyclerView是在
compile 'com.yanzhenjie:recyclerview-swipe:1.1.3' 包下面的

/**
* 必须在 Application 的 onCreate 方法中执行 BGASwipeBackHelper.init 来初始化滑动返回
* 第一个参数:应用程序上下文
* 第二个参数:如果发现滑动返回后立即触摸界面时应用崩溃,请把该界面里比较特殊的 View 的 class 添加到该集合中,目前在库中已经添加了 WebView 和 SurfaceView
*/
List<Class<? extends View>> l = new ArrayList<>();
l.add(SwipeMenuRecyclerView.class);
BGASwipeBackHelper.init(this, l);

添加之后还是崩溃

这说明好难用啊,能不能简单明了一点?

baseAcitity中没有用上toolBar,自己在各activity中使用toolbar。竟然 ,用了mSwipeBackHelper.forward(intent); 导致地面底部出现 透明,也就是可以看到 mainAcitity的界面。大约有八分之一的部位是透明的。怎么搞???

普通滑动返回的样式问题

  1. 在设置成普通返回样式的时候,发现底部Activity视图在跟随移动,如何能做到底部Activity固定不动,仅上层Activity滑动返回

  2. 在开启滑动返回功能之后,调用Activity的finish方法会自动左滑返回,如何能设置它按原生的转场动画方式返回

实践过程中的两个建议

1:侧滑时,露出的底部activity,可以用截图,如果对节点做add、remove,会触发onLayout,导致在一些手机上白底(比如oppo r7)
2:bindPreActivity 、unBindPreActivity,其实可以去掉,用截图的做法的话,在Shadow那个View初始化的时候,就可以开个子线程去渲染ImageView了;作者的做法,在底部Activity节点树比较深的情况,会有点延迟,导致侧滑了10多个dp才会去展开

经过以上两个做法之后,项目和Application没有关联了,可以去掉了app里面的初始化,更加紧凑

我设置了全屏显示,续承baseActivity后,度部的导航条不透明了

页面使用的是如下代码全屏,续承baseActivity后,度部的导航条不透明了
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = getWindow();
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
| WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(Color.TRANSPARENT);
window.setNavigationBarColor(Color.TRANSPARENT);
}

背景色问题

当输入法弹出时,如果上一个界面背景色很显眼,如红色,此时可以看到上一个界面的颜色 很突兀,demo中mainActivity中背景改为红色,即可测试看到效果

Activity全屏的问题

当我这是了webview播放视频,采用第三方的腾讯x5进行全屏播放,当我webviewActivity 切换全屏的时候 我的MainActivity生命周期会重新走一遍,导致弹出升级对话框(当有升级提示时候) 打印发现MainActivity 的 Oncreat重新走了一遍 而不是webviewActivity 的 Oncreat

Fragment

增加Fragment的侧滑效果

快速滑动返回会导致闪退

机型:
vivo x9 Android 6.0.1 Api:23
复现步骤:
进入三四个界面,此时快速滑动返回,就会报一个so的异常,缓慢滑动返回则没有问题,尝试解决了比较长的一段时间,但是最终没有解决。看网上的说法1.内存问题2.硬件加速问题3.序列化问题,不知道如何下手,楼主有什么建议吗?
log信息:
com.example.app.dev A/libc: Fatal signal 11 (SIGSEGV), code 2, fault addr 0x7f71d82ff0 in tid 8212 (RenderThread)
10-27 10:14:36.368 753-753/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
10-27 10:14:36.368 753-753/? A/DEBUG: Build fingerprint: 'vivo/PD1616/PD1616:6.0.1/MMB29M/compiler08162252:user/release-keys'
10-27 10:14:36.368 753-753/? A/DEBUG: Revision: '0'
10-27 10:14:36.368 753-753/? A/DEBUG: ABI: 'arm64'
10-27 10:14:36.368 753-753/? A/DEBUG: pid: 8106, tid: 8212, name: RenderThread >>> com.example.app.dev <<<
10-27 10:14:36.368 753-753/? A/DEBUG: signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0x7f71d82ff0
10-27 10:14:36.398 753-753/? A/DEBUG: x0 0000007f5f7dd848 x1 0000007f5fc4203c x2 0000000000000000 x3 0000000000000000
10-27 10:14:36.398 753-753/? A/DEBUG: x4 0000000000000001 x5 0000000000000000 x6 0000000000000000 x7 0000000000000000
10-27 10:14:36.398 753-753/? A/DEBUG: x8 0000000000000780 x9 0000000000000000 x10 0000000000000000 x11 0000000000000003
10-27 10:14:36.398 753-753/? A/DEBUG: x12 0000000000000001 x13 0000000000000000 x14 0000000000001f40 x15 0000007f5f4ef498
10-27 10:14:36.398 753-753/? A/DEBUG: x16 0000000000000000 x17 0000007f61c8c820 x18 0000007f81448000 x19 0000007f71e7f288
10-27 10:14:36.398 753-753/? A/DEBUG: x20 0000007f617d6200 x21 0000000000000001 x22 0000007f5fc42008 x23 0000007f61dfb800
10-27 10:14:36.398 753-753/? A/DEBUG: x24 0000007f71e7f288 x25 7fffffffffffffff x26 00000000ffffffff x27 0000007f7f02a2b0
10-27 10:14:36.398 753-753/? A/DEBUG: x28 0000007f60b73420 x29 0000007f71d83020 x30 0000007f814020b8
10-27 10:14:36.398 753-753/? A/DEBUG: sp 0000007f71d83020 pc 0000007f813ccf7c pstate 0000000060000000
10-27 10:14:36.418 753-753/? A/DEBUG: backtrace:
10-27 10:14:36.418 753-753/? A/DEBUG: #00 pc 0000000000034f7c /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #1 pc 000000000006a0b4 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #2 pc 0000000000069bb0 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #3 pc 000000000006a0c4 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #4 pc 0000000000069bb0 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #5 pc 000000000006a0c4 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #6 pc 0000000000069bb0 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #7 pc 000000000006a0c4 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #8 pc 0000000000069bb0 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #9 pc 000000000006a0c4 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #10 pc 0000000000069bb0 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #11 pc 000000000006a0c4 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #12 pc 0000000000069bb0 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #13 pc 000000000006a0c4 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #14 pc 0000000000069bb0 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #15 pc 000000000006a0c4 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #16 pc 0000000000069bb0 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #17 pc 000000000006a0c4 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #18 pc 0000000000069bb0 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #19 pc 000000000006a0c4 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #20 pc 0000000000069bb0 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #21 pc 000000000006a0c4 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #22 pc 0000000000069bb0 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #23 pc 000000000006a0c4 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #24 pc 0000000000069bb0 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #25 pc 000000000006a0c4 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #26 pc 0000000000069bb0 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #27 pc 000000000006a0c4 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #28 pc 0000000000069bb0 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #29 pc 000000000006a0c4 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #30 pc 0000000000069bb0 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #31 pc 000000000006a0c4 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #32 pc 0000000000069bb0 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #33 pc 000000000006a0c4 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #34 pc 0000000000069bb0 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #35 pc 000000000006a0c4 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #36 pc 0000000000069bb0 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #37 pc 000000000006a0c4 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #38 pc 0000000000069bb0 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #39 pc 000000000006a0c4 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #40 pc 0000000000069bb0 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #41 pc 000000000006a0c4 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #42 pc 0000000000069bb0 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #43 pc 000000000006a0c4 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #44 pc 0000000000069bb0 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #45 pc 000000000006a0c4 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #46 pc 0000000000069bb0 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #47 pc 000000000006a0c4 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #48 pc 0000000000069bb0 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #49 pc 000000000006a0c4 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #50 pc 0000000000069bb0 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #51 pc 000000000006a0c4 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #52 pc 0000000000069bb0 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #53 pc 000000000006a0c4 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #54 pc 0000000000069bb0 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #55 pc 000000000006a0c4 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #56 pc 0000000000069bb0 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #57 pc 000000000006a0c4 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #58 pc 0000000000069bb0 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #59 pc 000000000006a0c4 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #60 pc 0000000000069bb0 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #61 pc 000000000006a0c4 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #62 pc 0000000000069bb0 /system/lib64/libhwui.so
10-27 10:14:36.418 753-753/? A/DEBUG: #63 pc 000000000006a0c4 /system/lib64/libhwui.so
10-27 10:14:37.058 753-753/? A/DEBUG: Tombstone written to: /data/tombstones/tombstone_03
10-27 10:14:37.058 753-753/? E/DEBUG: AM write failed: Broken pipe
10-27 10:14:37.128 23692-23767/? E/JavaBinder: !!! FAILED BINDER TRANSACTION !!! (parcel size = 60

滑动返回导致布局下移

在有底部虚拟键Navigation Bar的机器上,从主界面A进入子界面 B的过程中,设置B的isSupportSwipeBack为true。其中A的布局为:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.slide.demo.MainActivity">

    <TextView
        android:id="@+id/tv_demo"
        android:layout_width="match_parent"
        android:layout_height="100dp"
        android:layout_gravity="bottom"
        android:background="@android:color/darker_gray"
        android:gravity="center"
        android:text="@string/app_name"
        android:textSize="20sp" />

</LinearLayout>

此时如果从B滑动返回到A,TextView会下沉虚拟Navigation Bar的高度。经排查,可能与TextView的layout_gravity属性设为bottom有关。

请问有没有合适的方案可解决这个问题

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.