Skip to content

Instantly share code, notes, and snippets.

@rajajawahar
Created May 22, 2018 07:26
Show Gist options
  • Save rajajawahar/79618da15f4e3d8e2393334c8b7e6cca to your computer and use it in GitHub Desktop.
Save rajajawahar/79618da15f4e3d8e2393334c8b7e6cca to your computer and use it in GitHub Desktop.
class MainActivity : AppCompatActivity() {
private var toolBar: Toolbar? = null
private var container: ViewGroup? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
coordinatorLayout {
fitsSystemWindows = true
appBarLayout {
toolBar = toolbar {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) elevation = 4f
}.lparams(width = matchParent, height = actionBarSize())
}.lparams(width = matchParent)
container = frameLayout()
.lparams(width = matchParent, height = matchParent) {
behavior = AppBarLayout.ScrollingViewBehavior()
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment