leotyndale/EnFloatingView

折叠屏,悬浮窗位置不能自动变换

Closed this issue · 3 comments

请用最新的折叠屏模拟器测试,如果在展开时把悬浮窗贴到屏幕右侧,然后把屏幕折上,悬浮窗就不会同步显示到小屏幕的右侧,会在屏幕外侧。根本看不见,是个严重的问题啊

在屏幕折叠监听里面重新add一下悬浮窗呢

已经测试,不能生效,还是不能自动显示对应的位置。
下面是代码
AndroidManifest.xml

<activity android:name=".MainActivity"
  android:configChanges="orientation|screenSize|smallestScreenSize|keyboardHidden|screenLayout">

MainActivity

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        FloatingView.get().add();
    }

    @Override
    protected void onStart() {
        super.onStart();
        FloatingView.get().attach(this);
    }

    @Override
    protected void onStop() {
        super.onStop();
        FloatingView.get().detach(this);
    }

    @Override
    public void onConfigurationChanged(@NonNull Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        Toast.makeText(this,"切换",Toast.LENGTH_SHORT).show();
        FloatingView.get().add();
    }
}

使用的模拟器:8 Foldable API 29
请您看看这种情况

1.4已修复该问题
在View的onConfigurationChanged中增加了moveToEdge处理