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

在外部使用setPopupGravity无效 #310

Closed
DaveBoy opened this issue Jul 2, 2020 · 9 comments
Closed

在外部使用setPopupGravity无效 #310

DaveBoy opened this issue Jul 2, 2020 · 9 comments
Labels
bug fixing 正在修复 pending release 待发布正式版

Comments

@DaveBoy
Copy link

DaveBoy commented Jul 2, 2020

  • 系统版本(必须):10
  • 库版本(必须):2.2.3
  • 问题描述/重现步骤(必须):
    xxxPop.setPopupGravity(Gravity.CENTER).showPopupWindow()
    反之如果在内部使用则无问题,如果外置到show之前就不行,没有使用showPopupWindow(v)

@razerdp
Copy link
Owner

razerdp commented Jul 2, 2020

外部和内部使用一样的说。。。有demo吗

@razerdp
Copy link
Owner

razerdp commented Jul 2, 2020

示例的demo展示里都是外部设置的。
微信截图_20200702223435

@DaveBoy
Copy link
Author

DaveBoy commented Jul 2, 2020

经过过我的实验,确定了是BaseLazyPopupWindow引发的问题。
以下实例中BaseLazyPopupWindow会出现该问题,BasePopupWindow则不会

HelloPop:
class HelloPop(context:Context):BaseLazyPopupWindow(context) {
    override fun onCreateContentView(): View {
        return createPopupById(R.layout.pop_helllo)
    }

}
:pop_helllo.xml
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="#ffffff">

    <TextView
        android:id="@+id/tv_hello"
        android:layout_width="match_parent"
        android:layout_height="100dp"
        android:text="Hello World!"
        android:gravity="center"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>

@razerdp
Copy link
Owner

razerdp commented Jul 2, 2020

噢,懒加载的时候在show的时候才会开始读xml,如果xml配置了gravity确实会覆盖。。。感谢提出~我现在修一修

razerdp added a commit that referenced this issue Jul 2, 2020
@razerdp razerdp added bug fixing 正在修复 pending release 待发布正式版 and removed pending release 待发布正式版 labels Jul 2, 2020
@razerdp
Copy link
Owner

razerdp commented Jul 2, 2020

candy 2.2.4.0703请查看一下

diff:8e456bc

@DaveBoy
Copy link
Author

DaveBoy commented Jul 2, 2020

tks,已解决

@DaveBoy DaveBoy closed this as completed Jul 2, 2020
@razerdp razerdp reopened this Jul 2, 2020
@razerdp
Copy link
Owner

razerdp commented Jul 2, 2020

1,先不要关闭哈。。。。我打上标记,等发了release我再统一关issue

@razerdp razerdp added the pending release 待发布正式版 label Jul 2, 2020
@DaveBoy
Copy link
Author

DaveBoy commented Jul 2, 2020

好的

@razerdp
Copy link
Owner

razerdp commented Jul 19, 2020

release 2.2.4 已经发布,本issue修复已被包含。
具体信息请到README或文档查阅新版本更新内容

@razerdp razerdp closed this as completed Jul 19, 2020
razerdp added a commit that referenced this issue Jun 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug fixing 正在修复 pending release 待发布正式版
Projects
None yet
Development

No branches or pull requests

2 participants