Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

弹幕切换横屏后 弹出位置异常 #29

Open
coolmaye opened this issue Jan 1, 2020 · 2 comments
Open

弹幕切换横屏后 弹出位置异常 #29

coolmaye opened this issue Jan 1, 2020 · 2 comments

Comments

@coolmaye
Copy link

coolmaye commented Jan 1, 2020

切换横屏后应该重新测量位置对吗?希望可以改一下,很多弹幕都是在视频上面,视屏都有横屏全屏播放的,其他功能都挺好的

@CharryLi
Copy link

CharryLi commented Apr 8, 2020

遇到同样的问题,请问有解决方案吗?

@JDChi
Copy link

JDChi commented Aug 30, 2022

我这边看的问题是在 DanMuView 这个类的 onDraw方法里会进行 initChannels,里面会把一开始 Canvas 的宽度设置给 Channel,然后就不会变更了。我的处理方法是重写DanMuViewonConfigurationChanged方法,在里面去更新宽度:

   // DanMuView.java
   @Override
    protected void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        if (danMuController != null) {
            danMuController.updateWidth(DeviceUtil.getScreenWidth(mContext));
        }
    }

   // DanMuController.java
   public void initChannels(Canvas canvas) {
        mCanvas = canvas;
        if (!channelCreated) {
            speedController.setWidthPixels(canvas.getWidth());
            danMuPoolManager.setSpeedController(speedController);
            danMuPoolManager.divide(canvas.getWidth(), canvas.getHeight());
            channelCreated = true;
        }
    }

   public void updateWidth(final int width){
        if(channelCreated && mCanvas != null){
            speedController.setWidthPixels(width);
            danMuPoolManager.divide(width, mCanvas.getHeight());
        }
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants