Android BottomSheetDialogFragment闪烁

问题描述

我从BottomSheetDialogFragment开始活动。

但是当我完成活动时,BottomSheetDialogFragment闪烁了。

我的案子就是这样的BottomSheetDialog background blinking

但是没有解决办法。

Here is my screen shot

代码简单而基本。

MainActivity.class

role = message.guild.roles.cache.find((r) => r.name === AssignedFactions[i]); //AssignedFactions is an array containing a list of roles,by the name of the role. I is a number,1-7,representing which player in the loop is currently being assigned. Loop will add +1 to i every time it assigns a player,and the loop will terminate when i > 7 or i > the player count.
let member = message.guild.members.cache.get(AssignedPlayers[i]); //AssignedPlayers is an array containing a list of the players in the game,by username
console.log(AssignedPlayers[i]);
console.log(AssignedFactions[i]);
console.log(member);
console.log(role);
member.roles.add(role).catch(console.error);

// member always returns undefined

BottomSheetFragment.class

class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        val bottomSheetFragment = BottomSheetFragment()

        button.setOnClickListener {

            bottomSheetFragment.show(supportFragmentManager,"")
        }
    }
}

解决方法

您的底部工作表没有闪烁。回到MainActivity时,它对活动的影响。 在您的MainActivity中,请在onCreate()之前实现overridePendingTransition

overridePendingTransition(0,0) //由于此默认效果将被删除

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...