Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android How to set multiple gravity values programmatically in Kotlin?

Tags:

android

kotlin

In Java it was like:

layoutParams.setGravity(Gravity.END|Gravity.BOTTOM);

How to do this in Kotlin?

like image 651
Maksim Ostrovidov Avatar asked Nov 14 '16 12:11

Maksim Ostrovidov


1 Answers

This operator is called "bitwise or" and it has analogue in Kotlin. Use it like this:

layoutParams.gravity = Gravity.END or Gravity.BOTTOM
like image 138
Maksim Ostrovidov Avatar answered Nov 19 '22 14:11

Maksim Ostrovidov