Skip to content

Instantly share code, notes, and snippets.

@nomisRev
Created October 30, 2016 17:42
Show Gist options
  • Save nomisRev/565034c29aaace0c1a0fcd98adf5ae62 to your computer and use it in GitHub Desktop.
Save nomisRev/565034c29aaace0c1a0fcd98adf5ae62 to your computer and use it in GitHub Desktop.
configuration(orientation = Orientation.LANDSCAPE, smallestWidth = 700) {
recyclerView {
init()
}.lparams(width = widthProcent(50), height = matchParent)
frameLayout().lparams(width = matchParent, height = matchParent)
}
fun <T : View> T.widthProcent(procent: Int): Int =
getAppUseableScreenSize().x.toFloat().times(procent.toFloat() / 100).toInt()
@LouisCAD
Copy link

Did you mean "percent" in place of "procent" everywhere in this file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment