This app shows two text lines stacked vertically with padding around them. It looks clean and easy to read.
import android.os.Bundle
import android.widget.LinearLayout
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val layout = LinearLayout(this).apply {
orientation = LinearLayout.VERTICAL
layoutParams = LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT
)
setPadding(32, 32, 32, 32)
}
val title = TextView(this).apply {
text = "Welcome to My App"
textSize = 24f
}
val subtitle = TextView(this).apply {
text = "Enjoy a clean and simple layout"
textSize = 16f
}
layout.addView(title)
layout.addView(subtitle)
setContentView(layout)
}
}