Created
August 31, 2019 16:31
-
-
Save mhrpatel12/7839ca2c75cfe40a5030fd93f6cd1ac6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun onActivityCreated(savedInstanceState: Bundle?) { | |
super.onActivityCreated(savedInstanceState) | |
(view?.parent as View).setBackgroundColor(Color.TRANSPARENT) | |
val resources = resources | |
if (resources.configuration.orientation == Configuration.ORIENTATION_PORTRAIT) { | |
assert(view != null) | |
val parent = view?.parent as View | |
val layoutParams = parent.layoutParams as CoordinatorLayout.LayoutParams | |
layoutParams.setMargins( | |
resources.getDimensionPixelSize(R.dimen.screen_margin), // LEFT 16dp | |
0, | |
resources.getDimensionPixelSize(R.dimen.screen_margin), // RIGHT 16dp | |
0 | |
) | |
parent.layoutParams = layoutParams | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment