Commit 3d2a4c34 authored by jiangyh's avatar jiangyh

android页面

parent ebf023b5
package com.example.testdemo
import android.app.Activity
import android.os.Bundle
import android.view.Gravity
import android.widget.LinearLayout
import android.widget.TextView
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
......@@ -13,10 +16,19 @@ class MainActivity : ComponentActivity() {
val message = com.example.testdemo.appInfo()
// 如果你用原生 View
setContentView(TextView(this).apply {
val root = LinearLayout(this).apply {
orientation = LinearLayout.VERTICAL
gravity = Gravity.CENTER
setPadding(24, 24, 24, 24)
}
val msgView = TextView(this).apply {
text = message
textSize = 24f
})
}
root.addView(msgView)
setContentView(root)
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment