简易Android名片制作

class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent {
            MyCardTheme {
                // A surface container using the 'background' color from the theme
                Surface(
                    modifier = Modifier.fillMaxSize(),
                    color = MaterialTheme.colorScheme.background
                ) {


                }
            }
        }
    }
}
@Composable
fun Image_BackGround(message: String, modifier: Modifier = Modifier){
    val image = painterResource(R.drawable.miku)
    Image(
        painter = image,
        contentDescription = null,
        contentScale = ContentScale.Crop,
        alpha = 0.8F
    )
}
@Composable
fun Head_Image(message: String, modifier: Modifier = Modifier){
    val image2 = painterResource(id = R.drawable.image_1705730544646)
    Image(
        painter = image2,
        contentDescription = null,
        modifier = Modifier
            .size(100.dp) // 设置图片尺寸
            .offset(120.dp, 50.dp)
    )
}

@Composable
fun Greeting(message: String, modifier: Modifier = Modifier) {
    Text(
        text = "$message",
        modifier = modifier
            .offset(110.dp, 320.dp)
            // 设置位置偏移,例如横向偏移 50.dp,纵向偏移 20.dp
    )
}



@Preview(showBackground = true)
@Composable
fun GreetingPreview() {
    MyCardTheme {
        Image_BackGround(message = "123")
        Head_Image("Happy Birthday Sam!")// 设置图片位置偏移) // 设置图片位置偏移)
        Greeting(message = "Name:HumanPlug\n   School:ECUST\n          Blog:\nhttps://www.cnblogs.com/\nhumanplug")
    }
}

file

本文由博客一文多发平台 OpenWrite 发布!

相关推荐

  1. vue制作简易日历

    2024-01-21 16:58:03       56 阅读
  2. 【Unity】制作简易计时器

    2024-01-21 16:58:03       26 阅读
  3. 制作Android分区镜像

    2024-01-21 16:58:03       30 阅读
  4. Android 开发制作系统签名

    2024-01-21 16:58:03       43 阅读
  5. Android 获取进程名称

    2024-01-21 16:58:03       63 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-01-21 16:58:03       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-01-21 16:58:03       101 阅读
  3. 在Django里面运行非项目文件

    2024-01-21 16:58:03       82 阅读
  4. Python语言-面向对象

    2024-01-21 16:58:03       91 阅读

热门阅读

  1. Crow:设置网站的index.html

    2024-01-21 16:58:03       59 阅读
  2. 运维之道—生产环境安装mysql

    2024-01-21 16:58:03       43 阅读
  3. 三国游戏(第十四届蓝桥杯)

    2024-01-21 16:58:03       48 阅读
  4. 一个月学会Python,零基础入门数据分析

    2024-01-21 16:58:03       49 阅读
  5. c++设计模式笔记

    2024-01-21 16:58:03       49 阅读
  6. go语言(十二)----多态

    2024-01-21 16:58:03       51 阅读
  7. 洛谷-P1802-5 倍经验日

    2024-01-21 16:58:03       53 阅读
  8. Crow:实现点击下载功能

    2024-01-21 16:58:03       58 阅读
  9. HBase鉴权设计以及Kerberos鉴权方法

    2024-01-21 16:58:03       63 阅读