Tag: 运算符 关键字

运算符==不能应用于Kotlin中的“Long”和“Int”

我试图在Kotlin中实现Mike Penz的NavigationDrawer( https://github.com/mikepenz/MaterialDrawer )的一部分。 从那时起,我只遇到几个问题,主要是与运营商。 这里是实例化抽屉本身的代码的一部分。 除了在int和Long变量上使用==运算符的位置,Android Studio不会引发任何错误: // Create the Drawer result = DrawerBuilder() .withSliderBackgroundColor(ContextCompat.getColor(applicationContext, R.color.top_header)) .withActivity(this) .withToolbar(toolbar) .withHasStableIds(true) .withItemAnimator(AlphaCrossFadeAnimator()) .withAccountHeader(headerResult!!) .addDrawerItems( PrimaryDrawerItem().withName(R.string.drawer_item_profile).withIcon(FontAwesome.Icon.faw_user).withIdentifier(1).withSelectable(false).withIconColor(ContextCompat.getColor(applicationContext, R.color.icon_grey)).withTextColor(ContextCompat.getColor(applicationContext, R.color.stroke)), PrimaryDrawerItem().withName(R.string.drawer_item_create).withIcon(FontAwesome.Icon.faw_paint_brush).withIdentifier(2).withSelectable(false).withIconColor(ContextCompat.getColor(applicationContext, R.color.icon_grey)).withTextColor(ContextCompat.getColor(applicationContext, R.color.stroke)), PrimaryDrawerItem().withName(R.string.drawer_item_yaanich_news).withIcon(FontAwesome.Icon.faw_newspaper_o).withIdentifier(3).withSelectable(false).withIconColor(ContextCompat.getColor(applicationContext, R.color.icon_grey)).withTextColor(ContextCompat.getColor(applicationContext, R.color.stroke)), PrimaryDrawerItem().withName(R.string.drawer_item_my_groups).withIcon(FontAwesome.Icon.faw_users).withIdentifier(4).withSelectable(false).withIconColor(ContextCompat.getColor(applicationContext, R.color.icon_grey)).withTextColor(ContextCompat.getColor(applicationContext, R.color.stroke)), PrimaryDrawerItem().withName(R.string.drawer_item_settings).withIcon(FontAwesome.Icon.faw_cog).withIdentifier(5).withSelectable(false).withIconColor(ContextCompat.getColor(applicationContext, R.color.icon_grey)).withTextColor(ContextCompat.getColor(applicationContext, R.color.stroke)) ) .withOnDrawerItemClickListener { view, position, drawerItem -> if (drawerItem != null) { var intent: Intent? = null […]