Upload files to "Tugas HelloWord"
This commit is contained in:
commit
63cb9c8fd1
26
Tugas HelloWord/MainActivity.kt
Normal file
26
Tugas HelloWord/MainActivity.kt
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
package com.example.hellobila
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import androidx.activity.enableEdgeToEdge
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import androidx.core.view.ViewCompat
|
||||||
|
import androidx.core.view.WindowInsetsCompat
|
||||||
|
|
||||||
|
class MainActivity : AppCompatActivity() {
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
|
// Mengaktifkan tampilan edge-to-edge agar aplikasi memenuhi seluruh layar
|
||||||
|
enableEdgeToEdge()
|
||||||
|
|
||||||
|
// Menghubungkan layout XML (activity_main.xml) dengan activity ini
|
||||||
|
setContentView(R.layout.activity_main)
|
||||||
|
|
||||||
|
// Menambahkan padding pada layout utama agar tidak tertimpa oleh status bar atau navigation bar
|
||||||
|
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
|
||||||
|
val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
|
||||||
|
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
|
||||||
|
insets
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user