{"id":6945,"date":"2024-07-23T11:01:01","date_gmt":"2024-07-23T03:01:01","guid":{"rendered":""},"modified":"2024-07-23T11:01:01","modified_gmt":"2024-07-23T03:01:01","slug":"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5","status":"publish","type":"post","link":"https:\/\/mushiming.com\/6945.html","title":{"rendered":"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5"},"content":{"rendered":"
\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

\/   \u4eca\u65e5\u79d1\u6280\u5feb\u8baf   \/<\/p>\n

\u8fd1\u65e5Facebook\u6bcd\u516c\u53f8Meta\u6700\u8fd1\u63a8\u51fa\u4e86\u6240\u8c13\u7684\u201c\u529e\u516c\u684c\u8f6e\u7528\u5236\u5ea6\u201d\uff0c\u4ee5\u4fbf\u6d4b\u8bd5\u65b0\u7684\u529e\u516c\u573a\u6240\u4f53\u9a8c\u3002\u7136\u800c\uff0c\u6b64\u4e3e\u62db\u6765\u8bb8\u591a\u5458\u5de5\u5410\u69fd\uff0c\u4ed6\u4eec\u79f0\u8be5\u5236\u5ea6\u201c\u592a\u4fd7\u201d\u3001\u201c\u4e0e\u73b0\u5b9e\u5b8c\u5168\u8131\u8282\u201d\u3002Meta\u901a\u77e5\u5458\u5de5\uff0c\u5927\u591a\u6570\u5458\u5de5\u5728\u529e\u516c\u5ba4\u91cc\u4e0d\u4f1a\u518d\u6709\u56fa\u5b9a\u4f4d\u7f6e\uff0c\u800c\u662f\u8981\u5728\u5230\u8fbe\u529e\u516c\u5ba4\u4e4b\u524d\u9884\u8ba2\u529e\u516c\u684c\u3002\u8fd9\u4e00\u4e3e\u63aa\u5f88\u5feb\u5c31\u906d\u5230\u4e86\u5458\u5de5\u7684\u5f3a\u70c8\u6297\u8bae\uff0c\u4ed6\u4eec\u65e2\u53cd\u5bf9\u8fd9\u9879\u63d0\u8bae\u672c\u8eab\uff0c\u4e5f\u4e0d\u6ee1\u8be5\u516c\u53f8\u63a8\u51fa\u8be5\u4e3e\u63aa\u65f6\u7ed9\u51fa\u7684\u201c\u4fd7\u6c14\u800c\u5e7c\u7a1a\u201d\u7684\u7406\u7531\u3002<\/p>\n

\/   \u4f5c\u8005\u7b80\u4ecb   \/<\/p>\n

\u5927\u5bb6\u5468\u4e00\u597d\uff0c\u65b0\u7684\u4e00\u5468\u7ee7\u7eed\u52a0\u6cb9\uff01<\/p>\n

\u672c\u7bc7\u6587\u7ae0\u8f6c\u81ea\u8def\u5f88\u957fOoO\u7684\u535a\u5ba2\uff0c\u6587\u7ae0\u4e3b\u8981\u5206\u4eab\u4e86\u5982\u4f55\u4f7f\u7528Compose\u8fdb\u884c\u5404\u7c7b\u81ea\u5b9a\u4e49\u6548\u679c\u7684\u5f00\u53d1\uff0c\u76f8\u4fe1\u4f1a\u5bf9\u5927\u5bb6\u6709\u6240\u5e2e\u52a9\uff01<\/p>\n

\u539f\u6587\u5730\u5740\uff1a<\/p>\n

\n

https:\/\/juejin.cn\/post\/<\/p>\n<\/blockquote>\n

\/   \u4ec0\u4e48\u90fd\u4e0d\u5982\u5b98\u7f51\u6765\u7684\u76f4\u63a5   \/<\/p>\n

Jetpack Compose\u53bb\u5e74\u5199\u4e86\u4e00\u4e9b\u5217\u8868\u5e03\u5c40\u5c31\u4e22\u4e0b\u4e86\uff0c\u4ee5\u524d\u4e00\u4e2a\u5c0f\u5144\u5f1f\u8bf4\u201c\u4ec0\u4e48\u90fd\u4e0d\u5982\u5b98\u7f51\u6765\u7684\u76f4\u63a5\u201d\u3002\u6253\u7b97\u7528Compose\u5199\u73a9\u5b89\u5353\u5927\u5bb6\u53ef\u4ee5\u53bb\u597d\u597d\u5b66\u4e60\u4e00\u6ce2\uff0c\u63a5\u4e0b\u6765\u6211\u4eec\u8ddf\u7740\u5b98\u7f51\u8d70\uff0c\u539f\u7406\u6848\u4f8b\u57fa\u4e8e\u5b98\u7f51\uff0c\u5199\u7684\u6548\u679c\u9ad8\u4e8e\u5b98\u7f51\u3002Flutter\uff0cSwiftUI\u5bf9\u6bd4\u8fd9\u4e9b\u4f17\u8bf4\u98ce\u4e91\uff0c\u4eba\u4e91\u4ea6\u4e91\uff0c\u6211\u4e0d\u591a\u8bf4\uff0cXML\u76f8\u5bf9\u4e8e\u5f53\u524d\u6d41\u884c\u7684\u524d\u6bb5\u6216\u8005\u79fb\u52a8\u7aef\u5e03\u5c40\u7ec4\u5efa\u6846\u67b6\u90fd\u4e0d\u5728\u662f\u4f18\u52bf\uff0c\u65e2\u7136Google\u63a8\u51fa\u7684\u90a3\u6211\u4eec\u5c31\u5b66\u3002 <\/p>\n

\/   \u73af\u5883   \/<\/p>\n

AndroidSdio Beta 4.2\u7248\u672c\u6216\u8005Canary\u7248\u672c<\/strong><\/p>\n

\u7248\u672c\u63d0\u4f9b\u6709\u597d\u7684\u754c\u9762\u9884\u89c8-\u5373\u65f6\u9884\u89c8Compose\u754c\u9762<\/strong><\/p>\n

\u786e\u4fdd\u60a8\u5728\u9879\u76ee\u4e2d\u4f7f\u7528\u7684\u662f Kotlin 1.4.21 \u6216\u66f4\u9ad8\u7248\u672c<\/strong><\/p>\n

\u9879\u76eebuild.gradle\u91cc\u9762\u914d\u7f6e\uff1a<\/p>\n

buildscript {     ext {         compose_version = '1.0.0-alpha04'     }     \/\/\u5927\u4e8e1.4.12\u7248\u672c     ext.kotlin_version = \"1.4.30\"     repositories {         google()         jcenter()     }     dependencies {         classpath 'com.android.tools.build:gradle:4.2.0-beta05'         classpath \"org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version\"     } }<\/code><\/pre>\n

app\u4e0b\u9762\u7684build.gradle\u914d\u7f6e\u5982\u4e0b<\/strong><\/p>\n

\u6700\u4f4eAPI\u7ea7\u522b\u8bbe\u7f6e\u4e3a21\u6216\u66f4\u9ad8\u7ea7\u522b\uff0c\u5e76\u5728\u5e94\u7528\u7684build.gradle\u6587\u4ef6\u4e2d\u542f\u7528Jetpack Compose\u3002\u6dfb\u52a0Jetpack Compose\u5de5\u5177\u5305\u4f9d\u8d56\u9879\u3002<\/p>\n

plugins {     id 'com.android.application'     id 'kotlin-android' } android {     compileSdkVersion 30     defaultConfig {         applicationId \"com.example.jetpackcompose\"         minSdkVersion 21\/\/\u6700\u4f4e API \u7ea7\u522b\u8bbe\u7f6e\u4e3a 21 \u6216\u66f4\u9ad8\u7ea7\u522b         targetSdkVersion 30         versionCode 1         versionName \"1.0\"         testInstrumentationRunner \"androidx.test.runner.AndroidJUnitRunner\"     }     buildTypes {         release {             minifyEnabled false             proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'         }     }     compileOptions {         sourceCompatibility JavaVersion.VERSION_1_8         targetCompatibility JavaVersion.VERSION_1_8     }     kotlinOptions {         jvmTarget = '1.8'         useIR = true     }     buildFeatures {         compose true\/\/\u5e76\u5728\u5e94\u7528\u7684 build.gradle \u6587\u4ef6\u4e2d\u542f\u7528 Jetpack Compose     }     composeOptions {         kotlinCompilerExtensionVersion compose_version         kotlinCompilerVersion '1.4.10'     } } dependencies {     implementation \"org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version\"     implementation 'androidx.core:core-ktx:1.3.1'     implementation 'androidx.appcompat:appcompat:1.2.0'     implementation 'com.google.android.material:material:1.2.1'     implementation \"androidx.compose.ui:ui:$compose_version\"     implementation \"androidx.compose.material:material:$compose_version\"     implementation \"androidx.ui:ui-tooling:$compose_version\"     implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.0-alpha06'     testImplementation 'junit:junit:4.+'     androidTestImplementation 'androidx.test.ext:junit:1.1.2'     androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' }<\/code><\/pre>\n

\u521b\u5efa\u9879\u76ee MainActivity.class\u3002<\/p>\n

package com.example.jetpackcompose import android.os.Bundle import androidx.appcompat.app.AppCompatActivity import androidx.compose.foundation.* import androidx.compose.ui.platform.setContent class MainActivity : AppCompatActivity() {     override fun onCreate(savedInstanceState: Bundle?) {         super.onCreate(savedInstanceState)         setContent {             Text(\"Hello World\")         }     } }<\/code><\/pre>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

\/   Layouts   \/<\/p>\n

\u63a5\u4e0b\u6765\u6211\u4eec\u5b66\u4e60-\u5982\u4f55\u4f7f\u7528Compose\u6784\u5efa\u7b80\u5355\u7684UI\u5e03\u5c40\uff0c\u5982\u6587\u672c,\u56fe\u7247\u4e4b\u7c7b\u7684\u7ec4\u4ef6\u4ee5\u53ca\u5217\u548c\u884c\u4e4b\u7c7b\u7684\u5bb9\u5668\u5e03\u5c40\u7ec4\u4ef6\uff0c\u4e0d\u7ba1\u662fFlutter\u3001SwiftUI\u3001HTML\u3001Compose...\u53ea\u8981\u5b66\u4f1a\u6700\u57fa\u672c\u7684\u884c\u548c\u5217\u52a0\u4e2aStack\uff0c\u57fa\u672c\u5c31\u80fd\u591f\u641e\u5b9a\u6240\u6709\u7684\u5e03\u5c40\u6837\u5f0f\u4e86\uff0c\u81f3\u4e8e\u7ec6\u8282\u548c\u4e0d\u5e38\u7528\u7684\u7ec4\u5efa\u770b\u5c5e\u6027\u3001\u770b\u5b98\u7f51\u3001\u770b\u767e\u5ea6\u5373\u53ef\u76f4\u63a5\u4e0a\u624b\u3002<\/p>\n

Jetpack Compose\u662f\u56f4\u7ed5\u53ef\u7ec4\u5408\u51fd\u6570\u6784\u5efa\u7684\uff0c\u6240\u6709\u7684\u90e8\u4ef6\u90fd\u662fCompose\uff0c\u53ea\u9700\u5c06@Composable\u6ce8\u91ca\u6dfb\u52a0\u5230\u51fd\u6570\u540d\u79f0\u4e2d\u5373\u53ef\u3002<\/p>\n

\u6587\u5b57\u76f8\u5173\u5c5e\u6027\u548c\u6848\u4f8b<\/strong><\/p>\n

\u6211\u4eec\u6765\u770b\u770b\u5b98\u65b9\u5e93\u63d0\u4f9b\u7684Text\u88ab@Composeable\u4e5f\u6ce8\u89e3\u6210\u4e3a\u53ef\u7ec4\u5408\u7ec4\u5efa\u3002\u5185\u90e8\u5b9a\u4e49\u4e86\u5f88\u591a\u6211\u4eec\u719f\u6089\u7684\u5c5e\u6027\u63d0\u4f9b\u5f00\u53d1\u8005\u8bbe\u7f6e\u3002<\/p>\n

@Composable fun Text(     text: String,     modifier: Modifier = Modifier,     color: Color = Color.Unset,     fontSize: TextUnit = TextUnit.Inherit,     fontStyle: FontStyle? = null,     fontWeight: FontWeight? = null,     fontFamily: FontFamily? = null,     letterSpacing: TextUnit = TextUnit.Inherit,     textDecoration: TextDecoration? = null,     textAlign: TextAlign? = null,     lineHeight: TextUnit = TextUnit.Inherit,     overflow: TextOverflow = TextOverflow.Clip,     softWrap: Boolean = true,     maxLines: Int = Int.MAX_VALUE,     onTextLayout: (TextLayoutResult) -> Unit = {},     style: TextStyle = currentTextStyle() ) {     Text(         AnnotatedString(text),         modifier,         color,         fontSize,         fontStyle,         fontWeight,         fontFamily,         letterSpacing,         textDecoration,         textAlign,         lineHeight,         overflow,         softWrap,         maxLines,         emptyMap(),         onTextLayout,         style     ) }<\/code><\/pre>\n

\u5230\u73b0\u5728\u662f\u4e0d\u662f\u8feb\u4e0d\u53ca\u5f85\u7684\u60f3\u5199\u4e00\u4e2aTextView\u5462\uff1f<\/p>\n

class ComposeStudy_01 : AppCompatActivity() {     override fun onCreate(savedInstanceState: Bundle?) {         super.onCreate(savedInstanceState)         setContent{             Text(\"Hello World\")         }     } }<\/code><\/pre>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

\u65e2\u7136\u63d0\u4f9b\u4e86\u8fd9\u4e48\u591a\u7684\u5c5e\u6027\u6211\u4eec\u4e0d\u59a8\u8bd5\u4e00\u8bd5\u5e38\u7528\u7684\u989c\u8272\u3001\u5b57\u4f53\u5927\u5c0f\u3001\u8fb9\u6846\u3001\u5b57\u4f53\u6837\u5f0f\u3001\u95f4\u8ddd\u3001\u52a0\u7c97\u7b49\u3002<\/p>\n

\u2b50\ufe0f \u8fd9\u91cc\u9700\u8981\u6ce8\u610f\u7684\u662f\u5c5e\u6027\u9ed8\u8ba4\u53ef\u4ee5\u4e0d\u5199\u53c2\u6570\u540d\u79f0\u6309\u7167\u53c2\u6570\u987a\u5e8f\u4ece\u4e0a\u5230\u4e0b\uff0c\u4f46\u662f\u5982\u679c\u4f60\u8981\u8df3\u7ea7\u8bbe\u7f6e\u5176\u4e2d\u4e24\u4e09\u4e2a\u6216\u591a\u4e2a\u9700\u8981\u5199\u53c2\u6570\u540d\u54e6\uff0c\u8fd9\u6837\u624d\u80fd\u5bf9\u5e94\u8d1f\u503c\uff0c\u7ed9\u521d\u5b66\u8005\u7684\u63d0\u793a\u3002<\/p>\n

class ComposeStudy_01 : AppCompatActivity() {     override fun onCreate(savedInstanceState: Bundle?) {         super.onCreate(savedInstanceState)         setContent {             Text(                 text = \"    Hello World\",                 \/\/`\u8fb9\u6846`                 modifier = Modifier.border(                     border = BorderStroke(                         width = 3.dp,                         color = Color(0xFF),                     ),                     shape = RoundedCornerShape(20f, 60f, 20f, 160f),                 ),                 \/\/`\u989c\u8272`\u3001                 color = Color.Green,                 \/\/`\u5b57\u4f53\u5927\u5c0f`\u3001                 fontSize = TextUnit.Sp(66),                 \/\/\u5b57\u5f62\u7684\u539a\u5ea6                 fontWeight = FontWeight.Bold,                 \/\/\u659c\u4f53                 fontStyle = FontStyle.Italic,                 fontFamily = FontFamily.Default,                 \/\/\u5b57\u4f53\u6c34\u5e73\u95f4\u9694                 letterSpacing = TextUnit.Em(0),                 \/\/\u5728\u6587\u672c\u4e0a\u65b9\u7ed8\u5236\u4e00\u6761\u6c34\u5e73\u7ebf                 textDecoration = TextDecoration.LineThrough             )         }     } }<\/code><\/pre>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

\u6587\u5b57\u5206\u88c5<\/strong><\/p>\n

\u65e2\u7136Jetpack Compose\u662f\u56f4\u7ed5\u53ef\u7ec4\u5408\u51fd\u6570\u6784\u5efa\u7684\u3002\u90a3\u6211\u4eec\u63a5\u4e0b\u6765\u5199\u4e2a\u901a\u7528\u7684\u6587\u5b57\u7ec4\u5efa\u901a\u8fc7@Compose\u3002<\/p>\n

override fun onCreate(savedInstanceState: Bundle?) {         super.onCreate(savedInstanceState)         setContent {             myText(\"    Hello World\")         }     }     @Composable     private fun myText(text:String) {         Text(             text = text,             \/\/`\u8fb9\u6846`             modifier = Modifier.border(                 border = BorderStroke(                     width = 3.dp,                     color = Color(0xFF),                 ),                 shape = RoundedCornerShape(20f, 60f, 20f, 160f),             ),             \/\/`\u989c\u8272`\u3001             color = Color.Green,             \/\/`\u5b57\u4f53\u5927\u5c0f`\u3001             fontSize = TextUnit.Sp(66),             \/\/\u5b57\u5f62\u7684\u539a\u5ea6             fontWeight = FontWeight.Bold,             \/\/\u659c\u4f53             fontStyle = FontStyle.Italic,             fontFamily = FontFamily.Default,             \/\/\u5b57\u4f53\u6c34\u5e73\u95f4\u9694             letterSpacing = TextUnit.Em(0),             \/\/\u5728\u6587\u672c\u4e0a\u65b9\u7ed8\u5236\u4e00\u6761\u6c34\u5e73\u7ebf             textDecoration = TextDecoration.LineThrough         )     }<\/code><\/pre>\n

\u662f\u4e0d\u662f\u89c9\u5f97\u8fd9\u6837\u5199Activity\u8fd8\u4e0d\u662f\u548cFlutter\u4e00\u6837\u5957\u5a03\u5a03\uff0c\u5f53\u7136\u4e0d\u7ba1\u662fCompose\u8fd8\u662fFlutter\u6216\u8005SwiftUI\u6211\u4eec\u90fd\u53ef\u4ee5\u5c06\u5176\u653e\u5728\u5176\u4ed6\u6587\u4ef6\u4e2d\u8fdb\u884c\u5206\u79bb\u5c01\u88c5\u3002\u5982\u4e0b\u6211\u4eec\u65b0\u5efa\u6587\u4ef6\u548c\u7c7b\u5939\u4e13\u95e8\u653e\u7f6e\u6211\u4eec\u7684UI\u3002<\/p>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

Modifier<\/strong><\/p>\n

\u5f53\u6211\u7528\u5230Modifier\u7684\u65f6\u5019\u6211\u5f88\u60ca\u53f9\uff0c\u8fd9\u4e0d\u662fSwiftUI\u4e48\uff1f\u4e8e\u662f\u6211\u5feb\u901f\u7684\u6253\u5f00\u4e86Xcode\u3002<\/p>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

Modifier\u7528\u4e8e\u88c5\u9970Compose UI\u5143\u7d20\u6216\u5411\u5176\u6dfb\u52a0\u884c\u4e3a\u3002\u4f8b\u5982\u80cc\u666f\uff0c\u586b\u5145\u548c\u5355\u51fb\u4e8b\u4ef6\u4fa6\u542c\u5668\u53ef\u4fee\u9970\u884c\u6216\u6dfb\u52a0\u884c\uff0c\u6587\u672c\u6216\u6309\u94ae\u7684\u884c\u4e3a\u3002<\/p>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

Modifier\u6765\u6dfb\u52a0\u70b9\u51fb\u4e8b\u4ef6<\/strong><\/p>\n

\u5f53\u6211\u70b9\u51fb\u65f6\u5019\u4fee\u6539\u5f53\u524d\u5b57\u4f53\u7684\u989c\u8272\uff0c\u6211\u4eec\u770b\u5230Modifier\u53ef\u4ee5\u8bbe\u7f6eclickable\uff0c\u63a5\u4e0b\u6765\u6211\u4eec\u8fdb\u884cModifier\u7684\u63a2\u7a76\u3002\u5f53\u6211\u53cc\u51fb\u65f6\u5019\u4e3a\u7ea2\u8272\uff0c\u5355\u673a\u65f6\u5019\u4e3a\u7eff\u8272\u3002<\/p>\n

\u5982\u4e0b\u4ee3\u7801\uff1a<\/p>\n

1.\u8bbe\u7f6e\u4e86\u5c40\u90e8\u53d8\u91cfcolor\u9ed8\u8ba4\u4e3a\u7eff\u8272<\/p>\n

2.\u5f53\u5355\u673a\u65f6\u5019\u8bbe\u7f6e\u4e3a\u9ec4\u8272<\/p>\n

3.\u53cc\u51fb\u4e3a\u7ea2\u8272<\/p>\n

@Composable fun myText(text: String) {     var color = Color.Green     Text(         text = text,         \/\/`\u8fb9\u6846`         modifier = Modifier.border(             border = BorderStroke(                 width = 3.dp,                 color = Color(0xFF),             ),             shape = RoundedCornerShape(20f, 60f, 20f, 160f),         ).clickable(             onClick = { color = Color.Yellow },             onDoubleClick = { color = Color.Red }         )...         }<\/code><\/pre>\n

\u8fd0\u884c\u4ee3\u7801\uff0c\u70b9\u51fb\u6548\u679c\u5982\u4e0b\uff1a\u5e76\u4e0d\u80fd\u4fee\u6539\u6548\u679c\u5440\uff01\u6b64\u65f6\u5f88\u591a\u5b66\u4e60\u8fc7Flutter\u548cSwiftUI\u7684\u4eba\u90fd\u660e\u767d\u4f60\u5e76\u6ca1\u6709\u5237\u65b0UI\u548b\u4e48\u53ef\u80fd\u6709\u6240\u6539\u53d8\u5462\u3002\u90a3\u5728Compose\u91cc\u9762\u662f\u5426\u6709\u63d0\u4f9b\u5982Flutter setState\u4e00\u6837\u7684\u7ec4\u4ef6\u3002<\/p>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

\u6211\u60f3\u5bf9\u4e8e\u6709\u57fa\u7840\u7684\u540c\u5b66modifier\u6211\u5c31\u4e0d\u591a\u5570\u55e6\u4e86\u3002\u5230\u8fd9\u91cc\u6211\u7ec8\u4e8e\u53ef\u4ee5\u8ba4\u771f\u7684\u8bf4\u4e00\u53e5\u771f\u7684\u5f88SwiftUI\u81f3\u4e8e\u662f\u5426\u81ea\u5b9a\u4e49\u4e5f\u548cSwiftUI\u4e00\u76f4\u8fd9\u4e2a\u6211\u4eec\u540e\u9762\u7ae0\u8282\u518d\u8ba8\u8bba\u548c\u6df1\u7a76\uff0c\u5982\u679c\u6ca1\u6709\u4e86\u5f88\u597d\u7684\u81ea\u5b9a\u4e49\u753b\u5e03\u8fd9\u4e9bAPI\u7684\u63d0\u4f9b\u4e5f\u5c31\u8d70\u4e0a\u4e86\u548cSwiftUI\u4e00\u6837\u7684\u9053\u8def\uff0c\u8fd9\u4e00\u70b9\u8ba9\u6211\u6df1\u6076\u75db\u7edd\u3002<\/p>\n

modifier = Modifier.clickable(             onClick = {                 nameState.value=Color.Yellow            },             onDoubleClick = {                 \/\/2.\u70b9\u51fb\u4e4b\u540e\u4e8b\u4ef6\u5411\u4e0a\u6d41\u52a8\u4fee\u6539\u72b6\u6001\u503c                 nameState.value=Color.Red             }         ).background(Color.Gray,shape = RectangleShapes)         .offset(x = Dp(10f),y=Dp(10f))         .drawShadow(elevation = Dp(10f)), @Stable val RectangleShapes: Shape = object : Shape {         val roudRect= RoundRect(10f,0f,1110f,910f,930f,160f)         override fun createOutline(size: Size, density: Density) = Outline.Rounded(roudRect)     }<\/code><\/pre>\n

UI\u5237\u65b0-State\u7684\u8fc7\u6e21<\/strong><\/p>\n

\u539f\u751fandroid JetPack\u4f7f\u7528\u8fc7\u7684\u4eba\u90fd\u77e5\u9053LiveData\u548cdatabinding\u90fd\u53ef\u4ee5\u8fdb\u884c\u548cUI\u540c\u6b65\u5237\u65b0\uff0cFlutter\u8fc7\u6765\u7684\u4eba\u90fd\u660e\u767dFlutter\u6709setState\u6211\u4eecCompose\u4e5f\u63d0\u4f9b\u4e86State\u7b49\u6765\u5237\u65b0UI\u7ec4\u4ef6\u3002\u7531\u4e8e\u6587\u5b57\u7bc7\u5e45\u95ee\u9898\u4f46\u662f\u53c8\u5fc5\u987b\u5237\u65b0UI\u6240\u4ee5\u6211\u4eec\u8fd9\u91cc\u5148\u4f7f\u7528State\u8fdb\u884c\u5237\u65b0UI\uff0c\u4e4b\u540e\u7684\u6709\u673a\u4f1a\u8be6\u7ec6\u8bb2\u89e3UI\u7684\u8ddf\u65b0\u3002<\/p>\n

\u5728Compose\u5e94\u7528\u4e2d\u4f7f\u7528\u7684\u5e38\u89c1\u53ef\u89c2\u5bdf\u7c7b\u578b\u5305\u62ecState\u3001LiveData\u3001StateFlow\u3001Flow\u548cObservable\u3002<\/p>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

\u7531\u4e8eFlutter\u7684\u4e60\u60ef\uff0c\u4e0d\u7981\u8ba9\u4eba\u60f3\u5230State\uff0c\u8fd9\u91cc\u4e8e\u662f\u6211\u8ddf\u7740\u627e\u5230\u4e86State\u4e14\u53bb\u4e86\u5b98\u7f51\u679c\u4e0d\u5176\u7136\u3002<\/p>\n

\u2728\u2728\u2728\u2728\u2728\u2728\u2728\u2728\u5728Jetpack Compose\u4e2d\uff0c\u72b6\u6001\u548c\u4e8b\u4ef6\u662f\u5206\u5f00\u7684\u3002\u72b6\u6001\u8868\u793a\u53ef\u66f4\u6539\u7684\u503c\uff0c\u800c\u4e8b\u4ef6\u8868\u793a\u6709\u60c5\u51b5\u53d1\u751f\u7684\u901a\u77e5\u3002\u901a\u8fc7\u5c06\u72b6\u6001\u4e0e\u4e8b\u4ef6\u5206\u5f00\uff0c\u53ef\u4ee5\u5c06\u72b6\u6001\u7684\u663e\u793a\u4e0e\u72b6\u6001\u7684\u5b58\u50a8\u548c\u66f4\u6539\u65b9\u5f0f\u89e3\u8026\u3002\u2728\u2728\u2728\u2728\u2728\u2728<\/p>\n

Compose\u4e13\u4e3a\u5355\u5411\u6570\u636e\u6d41\u800c\u6253\u9020\u3002\u8fd9\u662f\u4e00\u79cd\u72b6\u6001\u5411\u4e0b\u6d41\u52a8\u800c\u4e8b\u4ef6\u5411\u4e0a\u6d41\u52a8\u7684\u8bbe\u8ba1\u3002<\/p>\n

\u4e0a\u9762\u8bdd\u5982\u4f55\u7406\u89e3\u5462\uff1f\u6211\u4eec\u501f\u52a9\u4e00\u4e0b\u5b98\u7f51\u56fe\u7247\uff1a<\/p>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

\u4f2a\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n

1.\u72b6\u6001\u5373\u4e3a\u53ef\u66f4\u6539\u7684\u503c\u3010\u6570\u636e\uff0c\u7c7b\uff0c\u96c6\u5408\u2026\u3011<\/p>\n

2.\u4e8b\u4ef6\u3010\u5404\u79cd\u70b9\u51fb\u4e8b\u4ef6\uff0c\u6ed1\u52a8\u4e8b\u4ef6\uff0c\u8fd0\u884c\u65f6\uff0c\u5ef6\u8fdf\u6267\u884c\u7b49\u2026\u3011<\/p>\n

3.\u72b6\u6001\u3010\u53ef\u66f4\u6539\u7684\u72b6\u6001\u3011\u5fc5\u987b\u80af\u5b9a\u5b9a\u4e49\u5728\u4f8b\u5982Text\u4e4b\u4e0a\u5427\uff1f<\/p>\n

\/\/1.\u72b6\u6001  \u7b49\u5f85\u4e8b\u4ef6\u5411\u4e0a\u6d41\u52a8\u4fee\u6539\u72b6\u6001\u3002\u7136\u540e\u72b6\u6001\u5411\u4e0b\u6d41\u52a8\u53bb\u4fee\u6539\u989c\u8272 val nameState: MutableState<Color> = remember { mutableStateOf(Color.Green) } Text(     name,     \/\/\u8ddf\u65b0UI     color = nameState.value,     ...     \/\/2.\u4e8b\u4ef6 \u70b9\u51fb\u4e4b\u540e\u5411\u4e0a\u6d41\u52a8\u53bb\u4fee\u65391\u4e2d\u7684\u72b6\u6001     onclick(`nameState.value=Color.RED`) )<\/code><\/pre>\n

\u8fd9\u91cc\u7684nameState\u5c31\u662f\u72b6\u6001\uff0c\u800conclick\u5c31\u662f\u4e8b\u4ef6\uff0c\u5f53\u70b9\u51fb\u4e8b\u4ef6\u89e6\u53d1\u4e4b\u540e\u901a\u8fc7nameState.value\u4e8b\u4ef6\u5411\u4e0a\u6d41\u52a8\u53bb\u4fee\u6539\u72b6\u6001\u3002\u7136\u540e\u72b6\u6001\u5411\u4e0b\u6d41\u52a8\u5230UI\u4fee\u6539\u5b57\u4f53\u989c\u8272\u3002<\/p>\n

\u4e0b\u9762\u7684nameState\u5c31\u662f\u72b6\u6001\uff0c\u800conclick\u5c31\u662f\u4e8b\u4ef6\uff0c\u5f53\u70b9\u51fb\u4e8b\u4ef6\u89e6\u53d1\u4e4b\u540e\u901a\u8fc7nameState.value\u4e8b\u4ef6\u5411\u4e0a\u6d41\u52a8\u53bb\u4fee\u6539\u72b6\u6001\u3002\u7136\u540e\u72b6\u6001\u5411\u4e0b\u6d41\u52a8\u5230UI\u4fee\u6539\u5b57\u4f53\u989c\u8272\u3002<\/p>\n

@Composable fun myText(text: String) {     \/\/1.\u53ef\u6539\u53d8\u7684\u72b6\u6001     val nameState: MutableState<Color> = remember { mutableStateOf(Color.Green) }     \/\/3.\u4fee\u6539\u72b6\u6001\u4e4b\u540e\u72b6\u6001\u5411\u4e0b\u6d41\u52a8\u53bb\u4fee\u65394.\u4e2d\u7684UI     Text(         text = text,         \/\/`\u8fb9\u6846`         modifier = Modifier.border(             border = BorderStroke(                 width = 3.dp,                 color = Color(0xFF),             ),             shape = RoundedCornerShape(20f, 60f, 20f, 160f),         ).clickable(             onClick = {                 \/\/2.\u70b9\u51fb\u4e4b\u540e\u4e8b\u4ef6\u5411\u4e0a\u6d41\u52a8\u4fee\u6539\u72b6\u6001\u503c                 nameState.value=Color.Yellow            },             onDoubleClick = {                 \/\/2.\u70b9\u51fb\u4e4b\u540e\u4e8b\u4ef6\u5411\u4e0a\u6d41\u52a8\u4fee\u6539\u72b6\u6001\u503c                 nameState.value=Color.Red             }         ),         \/\/`\u989c\u8272`\u3001         \/\/4.\u72b6\u6001\u6d41\u52a8\u4e0b\u6765\u4fee\u6539UI\u663e\u793aUI         color = nameState.value,         \/\/`\u5b57\u4f53\u5927\u5c0f`\u3001         fontSize = TextUnit.Sp(66),         \/\/\u5b57\u5f62\u7684\u539a\u5ea6         fontWeight = FontWeight.Bold,         \/\/\u659c\u4f53         fontStyle = FontStyle.Italic,         fontFamily = FontFamily.Default,         \/\/\u5b57\u4f53\u6c34\u5e73\u95f4\u9694         letterSpacing = TextUnit.Em(0),         \/\/\u5728\u6587\u672c\u4e0a\u65b9\u7ed8\u5236\u4e00\u6761\u6c34\u5e73\u7ebf         textDecoration = TextDecoration.LineThrough     ) }<\/code><\/pre>\n

\u6548\u679c\uff1a\u53ef\u4ee5\u770b\u5230\u53cc\u51fb\u53d8\u4e3a\u7ea2\u8272\uff0c\u5355\u673a\u53d8\u4e3a\u9ec4\u8272\u3002<\/p>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

\u56fe\u7247<\/strong><\/p>\n

\u56fe\u7247\u5e38\u7528\u4e8e\u6211\u4eec\u5f00\u53d1\u4e2d\uff0c\u6211\u4eec\u63a5\u4e0b\u6765\u4f53\u9a8c\u4e00\u6ce2Image\u3002\u4e4b\u524d\u6211\u4eec\u5148\u6765\u770b\u770b@Preview\u7684\u5f3a\u5927\u3002<\/p>\n

@Preview \u6ce8\u89e3\u7684@Compose\u90fd\u4f1a\u5728\u9884\u89c8\u4e2d\u4e00\u4e00\u663e\u793a\uff0c\u8fd9\u8ba9\u6211\u4eec\u5f00\u53d1\u8fc7\u7a0b\u4e2d\u53ef\u4ee5\u5355\u72ec\u5c40\u90e8\u7684\u5904\u7406\u67d0\u4e00\u5904\u548c\u6574\u4f53\u5e03\u5c40\u5206\u79bb\u663e\u793a\uff0c\u63d0\u4f9b\u4e86\u66f4\u597d\u7684\u5355\u72ec\u7ba1\u7406\u548c\u663e\u793a\u65b9\u5f0f\u3002<\/p>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

Image<\/strong><\/p>\n

@Preview(name = \"studyImage\")     @Composable     fun StudyImageView() {         val imageBitmap: ImageBitmap = ImageBitmap.imageResource(R.drawable.head_god)         Image(             bitmap = imageBitmap,             contentDescription = resources.getString(R.string.app_name),         )     }<\/code><\/pre>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/strong><\/p>\n

Image\u5927\u5c0f\u88c1\u526a<\/strong><\/p>\n

@Composable fun Image(     bitmap: ImageBitmap,     contentDescription: String?,     modifier: Modifier = Modifier,     alignment: Alignment = Alignment.Center,     contentScale: ContentScale = ContentScale.Fit,     alpha: Float = DefaultAlpha,     colorFilter: ColorFilter? = null )<\/code><\/pre>\n

\u6e90\u7801\u4e2d\u5e76\u6ca1\u6709\u53d1\u73b0\u5927\u5c0f\u548c\u88c1\u526a\u7b49\u3002\u8fd9\u90e8\u5206\u8bbe\u7f6e\u6211\u4eec\u4e4b\u524d\u63d0\u5230\u8fc7\u901a\u8fc7modifier\u6765\u8bbe\u7f6e\u5427\uff0c\u90a3\u6211\u4eec\u6765\u5c0f\u8bd5\u725b\u5200\u3002<\/p>\n

@Preview(name = \"studyImage\")     @Composable     fun StudyImageView() {         val imageBitmap: ImageBitmap = ImageBitmap.imageResource(R.drawable.meinv)         Image(             bitmap = imageBitmap,             contentScale= ContentScale.FillBounds,             contentDescription = resources.getString(R.string.app_name),             modifier = Modifier                 .height(260.dp)                 .width(200.dp)                 .padding(horizontal = 30.dp,vertical = 30.dp)                 .clip(                     RoundedCornerShape(                         topEnd = 30.dp,                         topStart = 30.dp,                         bottomEnd = 30.dp,                         bottomStart = 30.dp                     )                 )         )     }<\/code><\/pre>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

\u6211\u4eec\u70b9\u51fb\u6e90\u7801\u53ef\u4ee5\u770b\u5230\u63d0\u4f9b\u7684\u88c1\u526aclip\u5b8c\u5168\u548cSwiftUI\u4e00\u6837\u3002\u5230\u8fd9\u91cc\u6211\u5f88\u62c5\u5fc3\u6ca1\u6709\u63d0\u4f9b\u81ea\u5b9a\u4e49View\u90a3\u4e00\u5957\uff0cGoogle\u5f00\u53d1\u4eba\u5458\u662f\u5199IOS\u7684\u5427\u3002\u518d\u770bShape\u53d1\u73b0\u6709\u5f88\u591a\u5b9e\u73b0\u7c7b,\u5927\u5bb6\u53ef\u4ee5\u4e00\u4e2a\u4e2a\u6d4b\u8bd5\u4e0b\u4e00\u6548\u679c\uff0c\u4e0a\u9762\u6211\u7528\u4e86RoundedCornerShape\uff0c\u5f53\u7136\u4e86\u5927\u5bb6\u6700\u5173\u5fc3\u7684\u81ea\u5b9a\u4e49\u88c1\u526a\u662f\u5426\u53ef\u4ee5\uff0c\u5f53\u7136\u6ca1\u95ee\u9898\u7684\uff0c\u901a\u8fc7\u5b9e\u73b0Shaper\u6765\u770b\u770b\u3002<\/p>\n

@Stable fun Modifier.clip(shape: Shape) = graphicsLayer(shape = shape, clip = true)<\/code><\/pre>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

\u6211\u4eec\u5b9e\u73b0Shape\u53d1\u73b0\u90fd\u8fd4\u56de\u4e00\u4e2aOutline\uff0c\u5c4c\u4e0d\u5c4c\u5168\u9760\u5b83\u4e86\uff0c\u63a5\u4e0b\u6765\u6211\u4eec\u770b\u770bOutline\u8fd9\u4e2a\u7c7b\u3002<\/p>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

\u6211\u4eec\u53d1\u73b0\u6709\u5f88\u591a\u5b57\u9762\u610f\u601d\u63d0\u4f9b\u5706\u89d2\u3001\u8fb9\u6846\u7ebf\u7b49\u4e5f\u770b\u5230\u4e86Generic\u63d0\u4f9b\u8def\u5f84\u88c1\u526a\u3002\u90a3\u6211\u4eec\u6765\u8bd5\u4e00\u8bd5\u3002<\/p>\n

@Preview(name = \"studyImage\")     @Composable     fun StudyImageView() {         val imageBitmap: ImageBitmap = ImageBitmap.imageResource(R.drawable.meinv)         Image(             bitmap = imageBitmap,             contentScale= ContentScale.FillBounds,             contentDescription = resources.getString(R.string.app_name),             modifier = Modifier                 .height(260.dp)                 .width(200.dp)                 .padding(horizontal = 30.dp,vertical = 30.dp)                 .clip(                     RectangleImageShapes                 )         )     }    @Stable     val RectangleImageShapes: Shape = object : Shape {         override fun createOutline(             size: Size,             layoutDirection: LayoutDirection,             density: Density         ): Outline {             val path= Path()             path.moveTo(0f,0f)             path.relativeLineTo(20f,20f)             path.relativeCubicTo(40f,40f,60f,60f,-20f,130f)             path.relativeCubicTo(40f,40f,60f,60f,-20f,130f)             path.relativeCubicTo(40f,40f,60f,60f,-20f,130f)             path.relativeCubicTo(40f,40f,60f,60f,-20f,130f)             path.relativeCubicTo(40f,40f,60f,60f,-20f,130f)             path.relativeCubicTo(40f,40f,60f,60f,-20f,130f)             path.lineTo(size.width,size.height)             path.lineTo(size.width,0f)             path.close()             return Outline.Generic(path)         }     }<\/code><\/pre>\n

\u6548\u679c\u5982\u4e0b\uff0c\u5230\u6b64-\u88c1\u526a\u5c4c\u4e0d\u5c4c\u4f60\u8bf4\u4e86\u7b97\u3002<\/p>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

Image \u548c\u5176\u4ed6\u90e8\u4ef6\u65cb\u8f6c\u3001\u5e73\u79fb\u3001\u7f29\u653e\u3001\u626d\u66f2\u53d8\u6362\u3001\u4fee\u9970\u3001\u70b9\u51fb\u62d6\u62fd\u7b49<\/strong><\/p>\n

\u5f53\u7136\u4e86\u56fe\u7247\u6216\u8005\u5176\u4ed6\u90e8\u4ef6\u65cb\u8f6c\u3001\u5e73\u79fb\u3001\u7f29\u653e\u3001\u626d\u66f2\u53d8\u6362\u3001\u4fee\u9970\u3001\u70b9\u51fb\u62d6\u62fd\u7b49\u90fd\u53ef\u4ee5\u901a\u8fc7Modifer\u53bb\u8fdb\u884c\u3002\u63a5\u4e0b\u6765\u6211\u4eec\u6765\u8fdb\u884c\u65cb\u8f6c\u548c\u62d6\u62fd\u7684\u5c0f\u64cd\u4f5c\u3002<\/p>\n

\u4ee3\u7801\u4e2d\u4ee5\u540e\u4f1a\u5e38\u5e38\u51fa\u73b0\u4e00\u5806\u7684Modifer\u548b\u4e48\u529e\uff1f\u62bd\u53d6\u5206\u88c5\u51fa\u6765\u66f4\u8212\u670d\u3002<\/p>\n

@Preview(name = \"studyImage\")     @Composable     fun StudyImageView() {         val draggerOffset:MutableState<Float> = remember{ mutableStateOf(0f) }         val imageBitmap: ImageBitmap = ImageBitmap.imageResource(R.drawable.meinv)         Image(             bitmap = imageBitmap,             contentScale = ContentScale.FillBounds,             contentDescription = resources.getString(R.string.app_name),             modifier = Modifier.ImageModifier(draggerOffset)         )     }     private fun Modifier.ImageModifier(draggerOffset: MutableState<Float>):Modifier =         composed { Modifier             .height(260.dp)             .width(200.dp)             .padding(horizontal = 30.dp, vertical = 30.dp)             .clip(                 RectangleImageShapes             )             .rotate(10f)             .draggable(state = DraggableState(onDelta = {                 draggerOffset.value = +it                 Log.e(\"ondelta\", \"StudyImageView: \" + draggerOffset.value)             }), orientation = Orientation.Horizontal)             .offset(x = draggerOffset.value.dp)            }<\/code><\/pre>\n

\u6548\u679c\u5982\u4e0b\uff1a<\/p>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

\u5e03\u5c40\u7684\u6446\u653e<\/strong><\/p>\n

Row\u884c\u4f5c\u4e3a\u6392\u5e03\u5bb9\u5668\u7ec4\u4ef6\uff0c\u662f\u6bcf\u4e00\u4e2a\u79fb\u52a8\u7aefAPI\u7b80\u5355\u800c\u4f7f\u7528\u7387\u6700\u9ad8\u7684\u4e00\u4e9b\u7ec4\u4ef6\u3002\u5185\u90e8\u5c06\u6c34\u5e73\u65b9\u5411\u4ece\u5de6\u5230\u53f3\u6392\u5e03\u3002<\/strong><\/p>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

@Preview(name = \"text1\")     @Composable     fun StudyLayoutViews() {         Row() {             Text(\"\u7b2c\u4e00\u5217\",fontSize = 22.sp,color = Color.White,modifier = Modifier.background(Color.Red))             Text(\"\u7b2c\u4e8c\u5217\",fontSize = 22.sp,color = Color.White,modifier = Modifier.background(Color.Green))             Text(\"\u7b2c\u4e09\u5217?\",fontSize = 22.sp,color = Color.White,modifier = Modifier.background(Color.Blue))         }     }<\/code><\/pre>\n

Row\u884c\u4f5c\u4e3a\u6392\u5e03\u5bb9\u5668\u7ec4\u4ef6\uff0c\u662f\u6bcf\u4e00\u4e2a\u79fb\u52a8\u7aefAPI\u7b80\u5355\u800c\u4f7f\u7528\u7387\u6700\u9ad8\u7684\u4e00\u4e9b\u7ec4\u4ef6\u3002\u5185\u90e8\u5c06\u7ad6\u76f4\u65b9\u5411\u4ece\u4e0a\u5230\u4e0b\u6392\u5e03\u3002<\/strong><\/p>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/strong><\/p>\n

Column() {             Text( \"\u7b2c\u4e00\u5217\",fontSize = 22.sp,color = Color.White,modifier = Modifier.background(Color.Red))             Text( \"\u7b2c\u4e8c\u5217\",fontSize = 22.sp,color = Color.White,modifier = Modifier.background(Color.Green))             Text( \"\u7b2c\u4e09\u5217\",fontSize = 22.sp,color = Color.White,modifier = Modifier.background(Color.Blue))         }<\/code><\/pre>\n

\u5f20\u98ce\u6377\u7279\u70c8\u4e4bFlutterUnit<\/strong><\/p>\n

\u5728\u7279\u70c8\u5927\u4f6c\u7684Flutter\u6587\u7ae0\u4e2d\u770b\u5230\u4e86\u4ed6\u521b\u4f5c\u7684FlutterUnit\u7684\u5374\u517b\u773c\uff0c\u63a5\u4e0b\u6765\u6211\u4eec\u6765\u8bd5\u7740\u7528Compose\u6765\u6a21\u4eff\u4e00\u6ce2\u3002<\/p>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

Item\u5206\u6790<\/p>\n

\u8fd9\u4e2aItem\u4eceRow\u548cColum\u5206\u6790\uff0cRow\u5206\u4e3a\u4e09\u4e2a\u5185\u5bb9\u56fe\u7247\u3001Colunm\u3001Icon\u3002\u4e2d\u95f4\u7684Colunm\u5206\u4e3a\u4e09\u884c\u3002<\/p>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

@Preview(name = \"text1\")     @Composable     fun StudyLayoutViews() {         val imageBitmap: ImageBitmap = ImageBitmap.imageResource(R.drawable.meinv)         val delectedIcon: ImageBitmap = ImageBitmap.imageResource(R.drawable.delected_icon)         Box(             modifier = Modifier                 .background(Color(206, 236, 250))                 .padding(10.dp)         ) {             Row(verticalAlignment = Alignment.CenterVertically) {                 Image(                     bitmap = imageBitmap,                     contentDescription = \"w\",                     contentScale = ContentScale.FillBounds,                     modifier = Modifier                         .height(50.dp)                         .width(50.dp)                         .background(Color.White, shape = CircleShape)                         .padding(3.dp)                         .clip(                             CircleShape                         )                         .shadow(elevation = 150.dp, clip = true)                 )                 Column(modifier = Modifier.padding(start = 5.dp)) {                     Text(                         \"Container\",                         fontSize = 16.sp,                         color = Color.Black,                     )                     Text(                         \"\u5bb9\u5668\u7ec4\u4ef6\",                         modifier = Modifier.padding(top = 3.dp, bottom = 3.dp),                         fontSize = 12.sp,                         color = Color.Gray,                     )                     Text(                         \"123\u4e07\u9605\u8bfb\u91cf\",                         fontSize = 8.sp,                         color = Color.White,                     )                 }                 Box(                     modifier = Modifier                         .height(60.dp)                         .padding(start = 30.dp),                     contentAlignment = Alignment.BottomCenter                 ) {                     Image(                         bitmap = delectedIcon,                         contentDescription = \"w\",                         contentScale = ContentScale.FillBounds,                         modifier = Modifier                             .height(20.dp)                             .width(20.dp)                             .shadow(elevation = 150.dp, clip = true)                     )                 }             }         }     }<\/code><\/pre>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

\u5230\u8fd9\u91cc\u6211\u4eec\u5df2\u7ecf\u5b66\u4f1a\u4e86\u57fa\u672c\u7684\u5e03\u5c40\u6392\u5217\uff0c\u5f53\u7136\u8fb9\u6846\u76ee\u524d\u8fd8\u662f\u6709\u5dee\u8ddd\u7684\uff0c\u5fc5\u5b9a\u662f\u81ea\u5b9a\u4e49\u7ed8\u5236\u88c1\u526a\u7684\u8fb9\u6846\u3002\u63a5\u4e0b\u6765\u6211\u4eec\u6765\u518d\u4f53\u9a8c\u4e00\u4e0bCompose\u7684\u88c1\u526a\u3002<\/p>\n

Shaper\u4e2d\u63d0\u4f9b\u7684Size\u5373\u6574\u4e2a\u7ec4\u4ef6\u7684\u5927\u5c0f\uff0c\u6211\u4eec\u901a\u8fc7\u76f8\u5bf9\u5f62\u6210\u5bf9\u5e94\u7684\u6846\u6700\u540e\u88c1\u526a\u753b\u5e03\u5373\u53ef\u3002<\/strong><\/p>\n

\u81f3\u4e8e\u81ea\u5b9a\u4e49\u4e0d\u719f\u7ec3\u7684\u53ef\u4ee5\u770b\u770b\u5f20\u98ce\u6377\u7279\u70c8\u6216\u8005\u6211\u7684\u6587\u7ae0\u3002<\/p>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

@Stable     val BoxClipShapes: Shape = object : Shape {         override fun createOutline(             size: Size,             layoutDirection: LayoutDirection,             density: Density         ): Outline {             val path = Path()             path.moveTo(20f, 0f)             path.relativeLineTo(-20f, 20f)             path.relativeLineTo(0f,size.height - 40f)             path.relativeLineTo(20f, 20f)             path.relativeLineTo(size.width \/ 3f-20, 0f)             path.relativeLineTo(15f, -20f)             path.relativeLineTo(size.width \/ 3f-30, 0f)             path.relativeLineTo(15f, 20f)             path.relativeLineTo(size.width \/ 3f-20, 0f)             path.relativeLineTo(20f, -20f)             path.relativeLineTo(0f, -(size.height - 40f))             path.relativeLineTo(-20f, -20f)             path.close()             return Outline.Generic(path)         }     }<\/code><\/pre>\n

\u662f\u4e0d\u662f\u8feb\u4e0d\u53ca\u5f85\u770b\u6548\u679c\u5462\uff1f<\/p>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

\u91cc\u9762\u7684\u661f\u661f\u6211\u5c31\u4e0d\u753b\u4e86\u3002\u6211\u610f\u601d\u662f\u5230\u8fd9\u91cc\u88c1\u526a\u90fd\u7ec3\u4f1a\u4e86\u5427\uff1f\u4e0d\u5bf9\u597d\u50cf\u4e0a\u9762\u4e5f\u4e0d\u4e00\u6837\u3002\u641e\u4e00\u6ce2\u4e0a\u90e8\u5427\u3002<\/p>\n

@Stable     val BoxClipShapes: Shape = object : Shape {         override fun createOutline(             size: Size,             layoutDirection: LayoutDirection,             density: Density         ): Outline {             val path = Path()             path.moveTo(20f, 0f)             path.relativeLineTo(-20f, 20f)             path.relativeLineTo(0f,size.height - 40f)             path.relativeLineTo(20f, 20f)             path.relativeLineTo(size.width \/ 3f-20, 0f)             path.relativeLineTo(15f, -20f)             path.relativeLineTo(size.width \/ 3f-30, 0f)             path.relativeLineTo(15f, 20f)             path.relativeLineTo(size.width \/ 3f-20, 0f)             path.relativeLineTo(20f, -20f)             path.relativeLineTo(0f, -(size.height - 40f))             path.relativeLineTo(-20f, -20f)             path.relativeLineTo(-(size.width \/ 3f-20),0f)             path.relativeLineTo(-15f,20f)             path.relativeLineTo(-(size.width \/ 3f-30), 0f)             path.relativeLineTo(-15f, -20f)             path.close()             return Outline.Generic(path)         }     }<\/code><\/pre>\n

\u6548\u679c\u5982\u4e0b\uff0c\u5f53\u7136\u4e86\u53ef\u4ee5\u65e0\u6bd4\u9a9a\uff0c\u770b\u8bbe\u8ba1\u4eba\u5458\u80fd\u8bbe\u8ba1\u51fa\u4e2a\u82b1\u6765\u90fd\u80fd\u884c\u3002<\/p>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

\u6211\u4eec\u770b\u7740\u6709\u6df1\u8272\u7684\u8fb9\u6846\u3002\u6211\u4eec\u8bd5\u4e00\u8bd5\u5bb9\u5668\u76d2\u5b50Box\u7684Modifier\u8bbe\u7f6eborder\u3002<\/p>\n

Box(modifier = Modifier.padding(20.dp) .clip(BoxClipShapes) .background(Color(206, 236, 250)) .border(width=1.dp,color = Color.Blue))<\/code><\/pre>\n

\u2b50\ufe0f\u2b50\ufe0f\u2b50\ufe0f\u2b50\ufe0f\u2b50\ufe0f\u2b50\ufe0f\u6548\u679c\u5982\u4e0b\uff0c\u8fd9\u6548\u679c\u592alow\u4e86\u5427\u3002\u4e3a\u561b\u4e2d\u95f4\u548c\u4e24\u8fb9\u6ca1\u6709\u5462\uff1f\u6211\u4eec\u770b\u770bborder\u6e90\u7801\uff0c\u5b83\u5c31\u662f\u4e2a\u77e9\u5f62\uff0c\u53ea\u662f\u88ab\u6211\u4eec\u65e0\u60c5\u7684\u88c1\u526a\u6389\u4e86\u4e2d\u95f4\u548c\u4e24\u8fb9\u89d2\u3002\u2b50\ufe0f\u2b50\ufe0f\u2b50\ufe0f\u2b50\ufe0f<\/p>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

\u6211\u4eec\u65e2\u7136\u8fdb\u884c\u4e86\u88c1\u526a\uff0c\u90a3\u4e48\u800c\u4e14border\u63d0\u4f9b\u4e86\u88c1\u526ashaper\uff0c\u90a3\u4e48\u6211\u4eec\u662f\u4e0d\u662f\u53ef\u4ee5\u8fdb\u884c\u5c06Box\u7684\u88c1\u526a\u8bbe\u7f6e\u5230Border\u548c\u88c1\u526a\u4e00\u81f4\u5462\uff1f<\/p>\n

Box(modifier = Modifier.padding(20.dp) .clip(BoxClipShapes) .background(Color(206, 236, 250)) .border(width=1.dp,color = Color(79, 129, 160),shape = BoxBorderClipShape)){    \u5185\u5bb9  }<\/code><\/pre>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

\u80af\u5b9a\u8fd8\u6709\u4eba\u8bf4\u4e0d\u4e00\u6837\u7684\u3002\u4e0a\u4ee3\u7801\u770b\u6548\u679c\uff1a<\/p>\n

\u6211\u4eec\u770b\u5230\u4e0a\u90e8\u6709\u90e8\u5206\u84dd\u8272\uff0c\u5176\u5b9e\u6574\u4f53\u89c2\u5bdf\u5e95\u90e8\u53c8\u4e00\u4e2a\u4e5f\u662f\u88c1\u526a\u4f46\u662f\u4e0a\u90e8\u6ca1\u6709\u88c1\u526a\u540c\u6b65\u7684Box\uff0c\u5185\u90e8\u518d\u88c5\u4e00\u4e2a\u4e0a\u4e0b\u90fd\u8fdb\u884c\u88c1\u526a\u7684Box\u662f\u4e0d\u662f\u5c31\u5b8c\u6210\u4e86\u8fd9\u4e2a\u6548\u679c\u3002<\/p>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

@Preview(name = \"text1\")     @Composable     fun StudyLayoutViews() {         val imageBitmap: ImageBitmap = ImageBitmap.imageResource(R.drawable.meinv)         val delectedIcon: ImageBitmap = ImageBitmap.imageResource(R.drawable.delected_icon)         Box(modifier = Modifier.clip(BoxBorderClipShape)             .background(Color(89, 199, 249))) {             Box(                 modifier = Modifier.padding(0.dp).clip(BoxClipShapes)                     .background(Color(206, 236, 250))                     .border(width = 1.dp, color = Color(89, 199, 249), shape = BoxClipShapes)             ) {                 Row(                     verticalAlignment = Alignment.CenterVertically,                     modifier = Modifier.padding(10.dp)                 ) {                     Image(                         bitmap = imageBitmap,                         contentDescription = \"w\",                         contentScale = ContentScale.FillBounds,                         modifier = Modifier                             .height(50.dp)                             .width(50.dp)                             .background(Color.White, shape = CircleShape)                             .padding(3.dp)                             .clip(                                 CircleShape                             )                             .shadow(elevation = 150.dp, clip = true)                     )                     Column(modifier = Modifier.padding(start = 5.dp)) {                         Text(                             \"Container\",                             fontSize = 16.sp,                             color = Color.Black,                         )                         Text(                             \"\u5bb9\u5668\u7ec4\u4ef6\",                             modifier = Modifier.padding(top = 3.dp, bottom = 3.dp),                             fontSize = 12.sp,                             color = Color.Gray,                         )                         Text(                             \"123\u4e07\u9605\u8bfb\u91cf\",                             fontSize = 8.sp,                             color = Color.White,                         )                     }                     Box(                         modifier = Modifier                             .height(60.dp)                             .padding(start = 30.dp, end = 5.dp),                         contentAlignment = Alignment.BottomCenter                     ) {                         Image(                             bitmap = delectedIcon,                             contentDescription = \"w\",                             modifier = Modifier                                 .height(16.dp)                                 .width(13.dp)                                 .shadow(elevation = 150.dp, clip = true)                         )                     }                 }             }         }     }<\/code><\/pre>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

\u5230\u8fd9\u91cc\u6211\u4eec\u5e94\u8be5\u5bf9SwiftUi\u82b1\u91cc\u80e1\u54e8\u7684\u88c1\u526a\u6ca1\u4ec0\u4e48\u95ee\u9898\u4e86\u5427\uff0c\u8bf4\u9519\u4e86Compose\uff1f\u6709\u95ee\u9898\u4e5f\u662f\u4f60\u5bf9\u81ea\u5b9a\u4e49\u4e0d\u719f\u6089\u3002\u5f53\u7136\u4e86\u4f60\u53ef\u4ee5\u53bb\u770b\u770b\u6211\u535a\u5ba2\u6216\u8005\u5176\u4ed6\u4f5c\u8005\u7684\u90fdok\u3002\u4f60\u4ee5\u4e3a\u5230\u8fd9\u91cc\u5c31\u7ed3\u675f\u4e86\u4e48\uff1f\u63a5\u4e0b\u6765\u624d\u8981\u8fdb\u5165\u6b63\u9898\u81ea\u5b9a\u4e49\u7ed8\u5236\uff0c\u88c1\u526a\u5728\u5f00\u53d1\u4e2d\u662f\u8fdc\u8fdc\u6ee1\u8db3\u4e0d\u4e86\u9700\u6c42\u7684\u4f8b\u5982\u66f2\u7ebf\u6216\u8005\u6298\u7ebf\u56fe\u8868\u7b49\u3002<\/p>\n

\/   Compose-\u81ea\u5b9a\u4e49\u7ed8\u5236   \/<\/p>\n

\u5bf9\u4e8e\u81ea\u5b9a\u4e49\u57fa\u7840\u548c\u76f8\u5173\u7684API\u5927\u5bb6\u4e0d\u719f\u6089\u7684\u53ef\u4ee5\u770b\u770b\u6211\u7684\u535a\u5ba2\u3002\u5728Compose\u4e2d\uff0c\u5927\u90e8\u5206\u7684API\u90fd\u5728androidx.compose.ui.graphics\u4e0b\uff0c\u6709\u5174\u8da3\u7684\u53ef\u4ee5\u591a\u770b\u770b\u3002<\/p>\n

\u4f60\u4ee5\u4e3a\u6211\u4f1a\u548c\u4e0a\u9762\u8fd9\u4e9b\u535a\u5ba2\u4e00\u6837\uff0c\u9762\u9762\u5177\u5230\u4e48\uff1f\u4e0a\u4ee3\u7801\u3002\u6ca1\u5fcd\u4f4f\u5199\u4e86\u70b9\u63d0\u793a\u6587\u5b57\u3002<\/p>\n

@Preview(name = \"MyLineView\")     @Composable     fun MyLineView(){         Canvas(             modifier = Modifier.padding(10.dp).width(200.dp).height(100.dp),         ){             drawIntoCanvas {canvas->                 val paint=Paint()                 paint.color=Color.Gray                 paint.style= PaintingStyle.Stroke                 \/\/1.\u53d8\u6362\u5750\u6807\u8f74                 canvas.translate(0f,size.height)                 canvas.scale(1f,-1f)                 \/\/2.\u7ed8\u5236Y\u8f74                 val pathY =Path()                 pathY.moveTo(0f,0f)                 pathY.relativeLineTo(0f,size.height)                 canvas.drawPath(pathY,paint)             }         }     }<\/code><\/pre>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

\u7ed8\u5236X\u8f74<\/strong><\/p>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

\u7ed8\u5236\u6298\u7ebf<\/strong><\/p>\n

\u7ed8\u5236\u4e5f\u5927\u81f4\u6d4f\u89c8\u4e86\u4e00\u904d\u57fa\u672c\u7684\u7ed8\u5236\u8fd8\u662f\u6709\u7684\u3002\u7ed8\u5236\u6587\u5b57\u6ca1\u627e\u5230\u2026\u5c34\u5c2c\u5230\u4e0d\u884c\u3002<\/p>\n

@Preview(name = \"MyLineView\")     @Composable     fun MyLineView(bitmap: ImageBitmap){         Canvas(             modifier = Modifier                 .padding(10.dp)                 .width(200.dp)                 .height(100.dp),         ){             drawIntoCanvas {canvas->                 val paint=Paint()                 paint.color=Color(208,208,208)                 paint.style= PaintingStyle.Stroke                 paint.strokeWidth=3f                 val paintFill=Paint()                 paintFill.color=Color.Gray                 paintFill.style= PaintingStyle.Stroke                 paintFill.strokeWidth=3f                 \/\/1.\u7ed8\u5236\u5750\u6807\u8f74                 canvas.translate(0f,size.height)                 canvas.scale(1f,-1f)                 \/\/2.\u7ed8\u5236x\u8f74                 val pathY =Path()                 pathY.moveTo(0f,0f)                 pathY.relativeLineTo(0f,size.height)                 canvas.drawPath(pathY,paint)                 \/\/2.\u7ed8\u5236y\u8f74                 val pathX =Path()                 pathX.moveTo(0f,0f)                 pathX.relativeLineTo(size.width,0f)                 canvas.drawPath(pathX,paint)                 val dataList:MutableList<Offset> =  mutableListOf(Offset(20f,60f),Offset(40f,30f),Offset(50f,34f),Offset(80f,54f),Offset(100f,34f),Offset(200f,134f),Offset(400f,154f),Offset(480f,134f))                 val linePath=Path()                 paint.color=Color.Blue                 val colors:MutableList<Color> = mutableListOf(Color.Red,Color.Blue,Color.Green)                 paint.shader= LinearGradientShader(Offset(0f,0f),Offset(size.width,0f),colors,null,TileMode.Clamp)                 paint.isAntiAlias=true                 \/\/3.\u7ed8\u5236\u6298\u7ebf\u586b\u5145                 for (index in 0 until dataList.size){                     linePath.lineTo(dataList[index].x,dataList[index].y)                 }                 linePath.lineTo(dataList[dataList.size-1].x,0f)                 linePath.close()                 \/\/\u7ed8\u5236\u586b\u5145                 paintFill.style= PaintingStyle.Fill                 paintFill.shader= LinearGradientShader(Offset(0f,size.height),Offset(0f,0f), arrayListOf(Color(59,157,254,161),Color(59,157,254,21)),null,TileMode.Clamp)                 canvas.drawPath(linePath,paintFill)                 \/\/2\u7ed8\u5236\u6298\u7ebf2                 val line =Path()                 for (index in 0 until dataList.size){                     line.lineTo(dataList[index].x,dataList[index].y)                 }                 paint.style= PaintingStyle.Stroke                 canvas.drawPath(line,paint)                 \/\/3\u7ed8\u5236\u5706\u5708                 paint.style= PaintingStyle.Fill                 for (index in 0 until dataList.size){                     canvas.drawCircle(Offset(dataList[index].x,dataList[index].y),6f,paint)                 }                 canvas.drawImage(image = bitmap, Offset(100f,100f),paint)             }         }     }<\/code><\/pre>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

\u5230\u8fd9\u91cc\u6211\u4eec\u4e0d\u4ec5\u5b66\u4f1a\u4e86\u5e03\u5c40\u7684\u6446\u653e\uff0c\u8fd8\u5b66\u4f1a\u4e86\u81ea\u5b9a\u4e49\u90e8\u4ef6\u3002\u6211\u60f3\u5f53\u4f60\u7684\u4ea7\u54c1UI\u63d0\u51fa\u518d\u53d8\u6001\u7684\u6837\u5f0f\u4f60\u5e94\u8be5\u4e0d\u5728\u8bdd\u4e0b\u3002<\/p>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

\/   \u5217\u8868   \/<\/p>\n

Compose\u4e2d\u53ef\u4ee5\u901a\u8fc7Column\u548cRow\u7ed3\u5408repate\u8fdb\u884c\u904d\u5386\u5f62\u6210\u5217\u8868\uff0c\u9ed8\u8ba4Column\u548cRow\u8d85\u51fa\u5c4f\u5e55\u662f\u4e0d\u53ef\u4ee5\u6ed1\u52a8\u7684\uff0c\u5f53\u7136\u53ef\u4ee5\u914d\u5408Modifer\u7684verticalScroll\u548chorizontalScroll\u8fdb\u884c\u6ed1\u52a8\u5185\u5bb9\u8bbe\u7f6e\u3002<\/p>\n

@Composable   fun ListStudy() {         \/\/\u8bbe\u7f6e\u6ed1\u52a8         val scrollState = rememberScrollState()         Column(modifier = Modifier.verticalScroll(scrollState)) {             \/\/\u904d\u5386\u5faa\u73af\u5185\u90e8Item\u90e8\u4ef6             repeat(100) {                 Row(                     modifier = Modifier                         .padding(10.dp)                         .fillMaxWidth(),                     horizontalArrangement = Arrangement.SpaceBetween                 ) {                     StudyLayoutViews()                     Spacer(modifier = Modifier.padding(horizontal = 5.dp))                     StudyLayoutViews()                 }             }         }     }<\/code><\/pre>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

LazyColumn<\/strong><\/p>\n

\u6570\u636e\u591f\u591a\u53d8\u5927\u5bfc\u81f4\u5217\u8868\u6027\u80fd\u51fa\u73b0\u95ee\u9898\uff0c\u8fd9\u65f6\u5019\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528LazyColumn\u3002<\/p>\n

\u4f7f\u7528\u5982\u4e0b\uff1a<\/p>\n

LazyColumn(state = scrollState) {         items(100) {            \u5185\u5bb9.....         }     }<\/code><\/pre>\n
@Composable     fun ListStudy() {         \/\/\u8bbe\u7f6e\u6ed1\u52a8         val scrollState = rememberScrollState()         val scrollLazyState = rememberLazyListState()         LazyColumn(state = scrollLazyState) {             \/\/\u904d\u5386\u5faa\u73af\u5185\u90e8Item\u90e8\u4ef6             items(100) {                 Row(                     modifier = Modifier                         .padding(10.dp)                         .fillMaxWidth(),                     horizontalArrangement = Arrangement.SpaceBetween                 ) {                     StudyLayoutViews()                     Spacer(modifier = Modifier.padding(horizontal = 5.dp))                     StudyLayoutViews()                 }             }         }     }<\/code><\/pre>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

\u5230\u8fd9\u91cc\u6211\u4eec\u7ed3\u5408\u5b98\u7f51\u4e0d\u4ec5\u5b66\u4f1a\u4e86\u57fa\u672c\u7684UI\u7ec4\u4ef6\u548c\u5bb9\u5668\u5217\u8868\u7ec4\u4ef6\uff0c\u800c\u4e14\u641e\u4e86\u4e00\u6ce2\u81ea\u5b9a\u4e49\u88c1\u526a\u548c\u7ed8\u5236\u3002\u5f53\u7136\u4e86Compose\u91cc\u9762\u8fd8\u6709\u5f88\u591a\u9700\u8981\u6211\u4eec\u53bb\u5c1d\u8bd5\u7684\u5185\u5bb9\uff0c\u52a8\u753b\uff0c\u72b6\u6001\u7684\u8ddf\u65b0\u7b49\u7b49\u2026\u6700\u540e\u6211\u4eec\u5199\u4e2a\u6848\u4f8b\u5b8c\u7f8e\u7ed3\u675f\u3002<\/p>\n

\/   \u6848\u4f8b   \/<\/p>\n

\u5b66\u5b8c\u4e86\u4e0a\u6587\u4e0b\u9762\u754c\u976210\u5206\u949f\u80fd\u641e\u5b9a\u4e0d\uff1f\u53ef\u80fd\u4e0d\u884c\uff0c\u597d\u50cf\u53c8\u6709\u81ea\u5b9a\u4e49\u90e8\u5206\u4e86\u3002\u63a5\u4e0b\u6765\u6211\u4eec\u8fdb\u884c\u6848\u4f8b\u5f00\u59cb\u3002<\/p>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

\u4e0a\u90e8\u56fe\u7247\u90e8\u5206<\/strong><\/p>\n

1.\u4e00\u4e2a\u6709\u5f27\u5ea6\u7684\u56fe\u7247\u4e0a\u90e8\u6709\u4e2a\u53d1\u5c04\u6027\u5706\u5708\u3002<\/p>\n

2.\u5e95\u90e8\u5f27\u5ea6\u56fe\u7247\u88c1\u526a\u3002<\/p>\n

3.\u9876\u90e8\u7684\u53d1\u5c04\u6027\u5706\u76d8\u3002<\/p>\n

\u5f27\u5ea6\u56fe\u7247<\/strong><\/p>\n

@Stable     class QureytoImageShapes(var hudu: Float = 100f) : Shape {         override fun createOutline(             size: Size,             layoutDirection: LayoutDirection,             density: Density         ): Outline {             val path = Path()             path.moveTo(0f, 0f)             path.lineTo(0f, size.height-hudu)             path.quadraticBezierTo(size.width\/2f, size.height, size.width, size.height-hudu)             path.lineTo(size.width,0f)             path.close()             return Outline.Generic(path)         }     }<\/code><\/pre>\n
@Preview(name = \"login\")     @Composable     fun LoginPage() {         val imageBitmap: ImageBitmap = ImageBitmap.imageResource(R.drawable.head_god)         val delectedIcon: ImageBitmap = ImageBitmap.imageResource(R.drawable.hean_lhc)         Box(contentAlignment = Alignment.Center) {             Image(                 bitmap = imageBitmap,                 contentDescription = \"\",                 contentScale=ContentScale.FillWidth,                 modifier = Modifier.fillMaxWidth().height(280.dp).clip(QureytoImageShapes(160f))             )             Image(bitmap = delectedIcon, contentDescription = \"\")         }     }<\/code><\/pre>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

\u9876\u90e8\u7684\u53d1\u5c04\u6027\u5706\u76d8<\/strong><\/p>\n

\u5e95\u90e8\u534a\u900f\u660e\u4e0a\u8272\u5706\uff0c\u9876\u90e8\u88c1\u526a\u7684\u5706\u5f62\u56fe\u7247\u6709Border\u4e0a\u9762\u5199\u8fc7\u7684\u3002\u518d\u6765\u4e00\u904d\u3002<\/p>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

@Preview(name = \"login\")     @Composable     fun LoginPage() {         val imageBitmap: ImageBitmap = ImageBitmap.imageResource(R.drawable.head_god)         val delectedIcon: ImageBitmap = ImageBitmap.imageResource(R.drawable.hean_lhc)         Box(contentAlignment = Alignment.Center) {             Image(                 bitmap = imageBitmap,                 contentDescription = \"\",                 contentScale=ContentScale.FillWidth,                 modifier = Modifier.fillMaxWidth().height(230.dp).clip(QureytoImageShapes(160f))             )             Box(                 contentAlignment=Alignment.Center,                 modifier = Modifier                     .padding(0.dp)                     .clip(CicleImageShape)                     .background(Color(206, 236, 250,121))                     .width(130.dp)                     .height(130.dp)             ){                 Image(                     bitmap = imageBitmap,                     contentDescription = \"w\",                     contentScale = ContentScale.FillBounds,                     modifier = Modifier                         .height(80.dp)                         .width(80.dp)                         .background(color = Color(0XFF0DBEBF), shape = CircleShape)                         .padding(3.dp)                         .clip(                             CircleShape                         )                         .shadow(elevation = 150.dp, clip = true)                 )             }         }     }<\/code><\/pre>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

\u4e2d\u95f4\u6587\u5b57\u90e8\u5206<\/strong><\/p>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

Box(contentAlignment = Alignment.Center,modifier = Modifier                 .fillMaxWidth()                 .padding(top =20.dp)) {                 Column(horizontalAlignment = Alignment.CenterHorizontally) {                     Text(text = \"ComposeUnit \u767b\u9646\",fontSize = 18.sp)                     Text(text = \"\u66f4\u591a\u7cbe\u5f69,\u66f4\u591a\u4f53\u9a8c ~\",fontSize = 12.sp,color = Color.Gray)                 }             }<\/code><\/pre>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

\u8f93\u5165\u6846\u90e8\u5206<\/strong><\/p>\n

Box(contentAlignment = Alignment.Center, modifier = Modifier                     .fillMaxWidth()                     .padding(top = 30.dp)             ) {                 TextField(                     value = \"   ConmposeUnit\",                     onValueChange = { },                     shape = RoundedCornerShape(18.dp),                     colors = textFieldColors(                         unfocusedIndicatorColor = Color.Transparent,                         backgroundColor = Color.White                     ),                     modifier = Modifier.border(                         1.dp,                         Color(111, 111, 111, 66),                         shape = RoundedCornerShape(18.dp)                     ),                     leadingIcon = { Icon(bitmap = deIcon, contentDescription = \"\") })             }<\/code><\/pre>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

\u9009\u4e2d\u72b6\u6001\u548c\u4e0b\u6587\u5b57\u5212\u7ebf\u7684\u8bbe\u7f6e<\/strong><\/p>\n

\u6587\u5b57\u6211\u4eec\u53ef\u4ee5\u4ece\u80cc\u666f\u88c1\u526a\u5165\u624b\u3002\u522b\u6253\u95ee\u53f7\u770b\u4ee3\u7801\u3002<\/p>\n

Box( modifier = Modifier                     .fillMaxWidth()                     .padding(top = 20.dp)             ) {                 Row(                     horizontalArrangement = Arrangement.SpaceBetween, modifier = Modifier                         .fillMaxWidth()                         .padding(  horizontal = 50.dp ,vertical = 20.dp)) {                             Checkbox(                                 checked = true,                                 onCheckedChange = { },                                 colors = CheckboxDefaults.colors(checkedColor = Color(0XFF0DBEBF))                             )                             Text(\"\u7528\u6237\u6ce8\u518c\",color=Color(0XFF0DBEBF),modifier = Modifier.border(1.dp,color=Color(0XFF0DBEBF),shape = LineUndFunction))                         }             } \u4e0b\u5212\u7ebf\u8bbe\u7f6e   val LineUndFunction:Shape = object :Shape{         override fun createOutline(             size: Size,             layoutDirection: LayoutDirection,             density: Density         ): Outline {             val path=Path()             path.moveTo(0f,size.height-2f)             path.lineTo(size.width,size.height-2f)             path.lineTo(size.width,size.height)             path.lineTo(0f,size.height)             path.close()             return Outline.Generic(path)         }     }<\/code><\/pre>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

\/   \u5199\u5728\u6700\u540e   \/<\/p>\n

Compose\u4eca\u5929\u8d70\u4e86\u4e00\u904d\uff0c\u57fa\u672c\u5c31\u662fSwiftUI\u53c8\u50cf\u6781\u4e86Flutter\uff0c\u5b83\u7684\u5374\u53ef\u4ee5\u521b\u9020\u51fa\u548cFlutter\u4e00\u6837\u7684\u6548\u7387\uff0c\u652f\u6301\u7248\u672c\u517c\u5bb9\u6027\u4f18\u79c0\u4e0eSwiftUI\uff0c\u4f46Kotlin\u9ad8\u9636\u51fd\u6570\u7684\u5404\u79cd\u5957\u8ba9\u521d\u5b66\u8005\u4e0d\u6613\u8bfb\u61c2\u6e90\u7801\uff0c\u540e\u671f\u4f1a\u8ba4\u771f\u5199\u7cfb\u5217\u6587\u7ae0\uff0c\u4f60\u5982\u679c\u4eca\u5929\u5b66\u5230\u4e86\u4e00\u4e9b\u4e1c\u897f\u6216\u8005\u6211\u5199\u7684\u6709\u95ee\u9898\u8bf7\u4f60\u70b9\u8d5e\u8bc4\u8bba\uff0c\u5e0c\u671b\u4e00\u8d77\u5b66\u4e60\u3002<\/p>\n

\u63a8\u8350\u9605\u8bfb\uff1a<\/p>\n

\u6211\u7684\u65b0\u4e66\uff0c\u300a\u7b2c\u4e00\u884c\u4ee3\u7801 \u7b2c3\u7248\u300b\u5df2\u51fa\u7248\uff01<\/p>\n

Android 13 Developer Preview\u4e00\u89c8<\/p>\n

\u4e00\u4e2a\u89e3\u51b3\u6ed1\u52a8\u51b2\u7a81\u7684\u65b0\u601d\u8def\uff0c\u65e0\u7f1d\u5d4c\u5957\u6ed1\u52a8<\/p>\n

\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u516c\u4f17\u53f7<\/p>\n

\u5b66\u4e60\u6280\u672f\u6216\u6295\u7a3f<\/p>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

\"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5<\/p>\n

\u957f\u6309\u4e0a\u56fe\uff0c\u8bc6\u522b\u56fe\u4e2d\u4e8c\u7ef4\u7801\u5373\u53ef\u5173\u6ce8<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"compose\u5b9e\u73b0_bootstrap\u65b9\u6cd5\/\u4eca\u65e5\u79d1\u6280\u5feb\u8baf\/\u8fd1\u65e5Facebook\u6bcd\u516c\u53f8Meta\u6700\u8fd1\u63a8\u51fa\u4e86\u6240\u8c13\u7684\u201c\u529e\u516c\u684c\u8f6e\u7528\u5236\u5ea6\u201d\uff0c\u4ee5\u4fbf\u6d4b\u8bd5\u65b0\u7684\u529e\u516c\u573a\u6240\u4f53\u9a8c","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"_links":{"self":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/6945"}],"collection":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/comments?post=6945"}],"version-history":[{"count":0,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/6945\/revisions"}],"wp:attachment":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/media?parent=6945"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/categories?post=6945"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/tags?post=6945"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}