Skip to content

Instantly share code, notes, and snippets.

@masaibar
Created August 7, 2018 08:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masaibar/ae70c3689a7f46e73e7d13a9cee813e6 to your computer and use it in GitHub Desktop.
Save masaibar/ae70c3689a7f46e73e7d13a9cee813e6 to your computer and use it in GitHub Desktop.
Androidで明示的に画面をOFFにさせない ref: https://qiita.com/masaibar/items/604aba552887ee0eb033
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:keepScreenOn="true">
...
</RelativeLayout>
class MainActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment