{"id":57752,"date":"2025-08-15T18:59:52","date_gmt":"2025-08-15T10:59:52","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/57752.html"},"modified":"2025-08-15T18:59:52","modified_gmt":"2025-08-15T10:59:52","slug":"%e9%b8%bf%e8%92%99%e4%b8%ad-%e9%80%89%e6%8b%a9%e5%99%a8textpicker%e7%bb%84%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/57752.html","title":{"rendered":"\u9e3f\u8499\u4e2d \u9009\u62e9\u5668TextPicker\u7ec4\u4ef6"},"content":{"rendered":"<p>\u672c\u6587\u540c\u6b65\u53d1\u8868\u4e8e\u6211\u7684<span>\u5fae\u4fe1\u516c\u4f17\u53f7<\/span>&#xff0c;\u5fae\u4fe1\u641c\u7d22 <span style=\"color:#6eaad7\">\u7a0b\u8bed\u65b0\u89c6\u754c<\/span> \u5373\u53ef\u5173\u6ce8&#xff0c;\u6bcf\u4e2a\u5de5\u4f5c\u65e5\u90fd\u6709\u6587\u7ae0\u66f4\u65b0<\/p>\n<h3>\u4e00\u3001TextPicker\u57fa\u7840\u5c5e\u6027<\/h3>\n<h4>1. \u57fa\u672c\u7528\u6cd5<\/h4>\n<p>&#064;Component<br \/>\nstruct TextPickerExample {<br \/>\n  &#064;State selectedIndex: number &#061; 2;<br \/>\n  private fruits: string[] &#061; [&#039;\u82f9\u679c&#039;, &#039;\u9999\u8549&#039;, &#039;\u6a59\u5b50&#039;, &#039;\u8461\u8404&#039;, &#039;\u897f\u74dc&#039;];<\/p>\n<p>  build() {<br \/>\n    Column() {<br \/>\n      TextPicker({<br \/>\n        range: this.fruits,<br \/>\n        selected: this.selectedIndex<br \/>\n      })<br \/>\n      .onChange((value: string, index: number) &#061;&gt; {<br \/>\n        this.selectedIndex &#061; index;<br \/>\n        console.log(&#039;\u5f53\u524d\u9009\u62e9:&#039;, value, &#039;\u7d22\u5f15:&#039;, index);<br \/>\n      })<\/p>\n<p>      Text(&#096;\u5f53\u524d\u9009\u62e9: ${this.fruits[this.selectedIndex]}&#096;)<br \/>\n        .margin({ top: 20 })<br \/>\n    }<br \/>\n    .width(&#039;100%&#039;)<br \/>\n    .padding(20)<br \/>\n  }<br \/>\n} <\/p>\n<h4>2. \u4e3b\u8981\u5c5e\u6027API<\/h4>\n<table>\n<tr>API\u7c7b\u578b\u63cf\u8ff0\u793a\u4f8b<\/tr>\n<tbody>\n<tr>\n<td>range()<\/td>\n<td>Array&lt;string&gt;<\/td>\n<td>\u8bbe\u7f6e\u9009\u62e9\u9879\u6570\u636e\u6e90<\/td>\n<td>.range([&#039;A&#039;,&#039;B&#039;,&#039;C&#039;])<\/td>\n<\/tr>\n<tr>\n<td>selected()<\/td>\n<td>number<\/td>\n<td>\u8bbe\u7f6e\u9ed8\u8ba4\u9009\u4e2d\u9879\u7d22\u5f15<\/td>\n<td>.selected(0)<\/td>\n<\/tr>\n<tr>\n<td>value()<\/td>\n<td>string<\/td>\n<td>\u8bbe\u7f6e\u9ed8\u8ba4\u9009\u4e2d\u9879\u7684\u503c<\/td>\n<td>.value(&#039;\u5317\u4eac&#039;)<\/td>\n<\/tr>\n<tr>\n<td>defaultPickerItemHeight()<\/td>\n<td>Length<\/td>\n<td>\u8bbe\u7f6e\u9009\u9879\u9ad8\u5ea6<\/td>\n<td>.defaultPickerItemHeight(50)<\/td>\n<\/tr>\n<tr>\n<td>itemSize()<\/td>\n<td>number<\/td>\n<td>\u8bbe\u7f6e\u53ef\u89c1\u9009\u9879\u6570\u91cf<\/td>\n<td>.itemSize(5)<\/td>\n<\/tr>\n<tr>\n<td>textStyle()<\/td>\n<td>PickerTextStyle<\/td>\n<td>\u8bbe\u7f6e\u6587\u672c\u6837\u5f0f<\/td>\n<td>.textStyle({ fontSize: 20 })<\/td>\n<\/tr>\n<tr>\n<td>selectedTextStyle()<\/td>\n<td>PickerTextStyle<\/td>\n<td>\u8bbe\u7f6e\u9009\u4e2d\u9879\u6587\u672c\u6837\u5f0f<\/td>\n<td>.selectedTextStyle({ color: Color.Red })<\/td>\n<\/tr>\n<tr>\n<td>disappearTextStyle()<\/td>\n<td>PickerTextStyle<\/td>\n<td>\u8bbe\u7f6e\u975e\u9009\u4e2d\u9879\u6587\u672c\u6837\u5f0f<\/td>\n<td>.disappearTextStyle({ color: Color.Gray })<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\u4e8c\u3001TextPicker\u6837\u5f0f\u5b9a\u5236<\/h3>\n<h4>1. \u81ea\u5b9a\u4e49\u6587\u672c\u6837\u5f0f<\/h4>\n<p>&#064;Component<br \/>\nstruct StyledTextPicker {<br \/>\n  &#064;State selectedIndex: number &#061; 0;<br \/>\n  private cities: string[] &#061; [&#039;\u5317\u4eac&#039;, &#039;\u4e0a\u6d77&#039;, &#039;\u5e7f\u5dde&#039;, &#039;\u6df1\u5733&#039;, &#039;\u676d\u5dde&#039;];<\/p>\n<p>  build() {<br \/>\n    Column() {<br \/>\n      TextPicker({<br \/>\n        range: this.cities,<br \/>\n        selected: this.selectedIndex<br \/>\n      })<br \/>\n      .textStyle({<br \/>\n        fontSize: 16,<br \/>\n        color: Color.Black<br \/>\n      })<br \/>\n      .selectedTextStyle({<br \/>\n        fontSize: 20,<br \/>\n        color: Color.Blue,<br \/>\n        fontWeight: FontWeight.Bold<br \/>\n      })<br \/>\n      .disappearTextStyle({<br \/>\n        fontSize: 14,<br \/>\n        color: Color.Gray,<br \/>\n        opacity: 0.6<br \/>\n      })<br \/>\n      .onChange((value: string, index: number) &#061;&gt; {<br \/>\n        this.selectedIndex &#061; index;<br \/>\n      })<br \/>\n    }<br \/>\n    .width(&#039;100%&#039;)<br \/>\n    .padding(20)<br \/>\n  }<br \/>\n} <\/p>\n<h4>2. \u8bbe\u7f6e\u9009\u9879\u9ad8\u5ea6\u548c\u6570\u91cf<\/h4>\n<p>&#064;Component<br \/>\nstruct CustomSizeTextPicker {<br \/>\n  &#064;State selectedIndex: number &#061; 0;<br \/>\n  private colors: string[] &#061; [&#039;\u7ea2\u8272&#039;, &#039;\u6a59\u8272&#039;, &#039;\u9ec4\u8272&#039;, &#039;\u7eff\u8272&#039;, &#039;\u84dd\u8272&#039;, &#039;\u975b\u84dd&#039;, &#039;\u7d2b\u8272&#039;];<\/p>\n<p>  build() {<br \/>\n    Column() {<br \/>\n      TextPicker({<br \/>\n        range: this.colors,<br \/>\n        selected: this.selectedIndex<br \/>\n      })<br \/>\n      .defaultPickerItemHeight(60) \/\/ \u8bbe\u7f6e\u9009\u9879\u9ad8\u5ea6<br \/>\n      .itemSize(3) \/\/ \u8bbe\u7f6e\u53ef\u89c1\u9009\u9879\u6570\u91cf<br \/>\n      .onChange((value: string, index: number) &#061;&gt; {<br \/>\n        this.selectedIndex &#061; index;<br \/>\n      })<\/p>\n<p>      Text(&#096;\u5f53\u524d\u989c\u8272: ${this.colors[this.selectedIndex]}&#096;)<br \/>\n        .fontColor(this.getColor(this.colors[this.selectedIndex]))<br \/>\n        .margin({ top: 20 })<br \/>\n    }<br \/>\n    .width(&#039;100%&#039;)<br \/>\n    .padding(20)<br \/>\n  }<\/p>\n<p>  private getColor(colorName: string): Color {<br \/>\n    switch(colorName) {<br \/>\n      case &#039;\u7ea2\u8272&#039;: return Color.Red;<br \/>\n      case &#039;\u6a59\u8272&#039;: return Color.Orange;<br \/>\n      case &#039;\u9ec4\u8272&#039;: return Color.Yellow;<br \/>\n      case &#039;\u7eff\u8272&#039;: return Color.Green;<br \/>\n      case &#039;\u84dd\u8272&#039;: return Color.Blue;<br \/>\n      case &#039;\u975b\u84dd&#039;: return 0x4B0082;<br \/>\n      case &#039;\u7d2b\u8272&#039;: return 0x800080;<br \/>\n      default: return Color.Black;<br \/>\n    }<br \/>\n  }<br \/>\n} <\/p>\n<h3>\u4e09\u3001\u591a\u5217TextPicker<\/h3>\n<h4>1. \u591a\u5217\u8054\u52a8\u9009\u62e9\u5668<\/h4>\n<p>&#064;Component<br \/>\nstruct MultiTextPicker {<br \/>\n  &#064;State provinceIndex: number &#061; 0;<br \/>\n  &#064;State cityIndex: number &#061; 0;<\/p>\n<p>  private provinces: string[] &#061; [&#039;\u5e7f\u4e1c\u7701&#039;, &#039;\u6d59\u6c5f\u7701&#039;, &#039;\u6c5f\u82cf\u7701&#039;];<br \/>\n  private cities: string[][] &#061; [<br \/>\n    [&#039;\u5e7f\u5dde&#039;, &#039;\u6df1\u5733&#039;, &#039;\u73e0\u6d77&#039;, &#039;\u4e1c\u839e&#039;],<br \/>\n    [&#039;\u676d\u5dde&#039;, &#039;\u5b81\u6ce2&#039;, &#039;\u6e29\u5dde&#039;, &#039;\u7ecd\u5174&#039;],<br \/>\n    [&#039;\u5357\u4eac&#039;, &#039;\u82cf\u5dde&#039;, &#039;\u65e0\u9521&#039;, &#039;\u5e38\u5dde&#039;]<br \/>\n  ];<\/p>\n<p>  build() {<br \/>\n    Column({ space: 30 }) {<br \/>\n      \/\/ \u7701\u4efd\u9009\u62e9<br \/>\n      Text(&#039;\u9009\u62e9\u7701\u4efd:&#039;)<br \/>\n        .fontSize(16)<br \/>\n        .width(&#039;100%&#039;)<\/p>\n<p>      TextPicker({<br \/>\n        range: this.provinces,<br \/>\n        selected: this.provinceIndex<br \/>\n      })<br \/>\n      .onChange((value: string, index: number) &#061;&gt; {<br \/>\n        this.provinceIndex &#061; index;<br \/>\n        this.cityIndex &#061; 0; \/\/ \u91cd\u7f6e\u57ce\u5e02\u9009\u62e9<br \/>\n      })<\/p>\n<p>      \/\/ \u57ce\u5e02\u9009\u62e9<br \/>\n      Text(&#039;\u9009\u62e9\u57ce\u5e02:&#039;)<br \/>\n        .fontSize(16)<br \/>\n        .width(&#039;100%&#039;)<\/p>\n<p>      TextPicker({<br \/>\n        range: this.cities[this.provinceIndex],<br \/>\n        selected: this.cityIndex<br \/>\n      })<br \/>\n      .onChange((value: string, index: number) &#061;&gt; {<br \/>\n        this.cityIndex &#061; index;<br \/>\n      })<\/p>\n<p>      Text(&#096;\u60a8\u9009\u62e9: ${this.provinces[this.provinceIndex]} ${this.cities[this.provinceIndex][this.cityIndex]}&#096;)<br \/>\n        .margin({ top: 20 })<br \/>\n    }<br \/>\n    .width(&#039;100%&#039;)<br \/>\n    .padding(20)<br \/>\n  }<br \/>\n} <\/p>\n<h4>2. \u65e5\u671f\u9009\u62e9\u5668\u5b9e\u73b0<\/h4>\n<p>&#064;Component<br \/>\nstruct DatePickerExample {<br \/>\n  &#064;State yearIndex: number &#061; 5;<br \/>\n  &#064;State monthIndex: number &#061; 6;<br \/>\n  &#064;State dayIndex: number &#061; 15;<\/p>\n<p>  private years: string[] &#061; Array.from({length: 20}, (_, i) &#061;&gt; &#096;${2000 &#043; i}\u5e74&#096;);<br \/>\n  private months: string[] &#061; Array.from({length: 12}, (_, i) &#061;&gt; &#096;${i &#043; 1}\u6708&#096;);<br \/>\n  private days: string[] &#061; Array.from({length: 31}, (_, i) &#061;&gt; &#096;${i &#043; 1}\u65e5&#096;);<\/p>\n<p>  build() {<br \/>\n    Column({ space: 10 }) {<br \/>\n      Text(&#039;\u9009\u62e9\u65e5\u671f&#039;)<br \/>\n        .fontSize(18)<br \/>\n        .margin({ bottom: 20 })<\/p>\n<p>      Row({ space: 10 }) {<br \/>\n        \/\/ \u5e74\u9009\u62e9<br \/>\n        TextPicker({<br \/>\n          range: this.years,<br \/>\n          selected: this.yearIndex<br \/>\n        })<br \/>\n        .onChange((value: string, index: number) &#061;&gt; {<br \/>\n          this.yearIndex &#061; index;<br \/>\n        })<\/p>\n<p>        \/\/ \u6708\u9009\u62e9<br \/>\n        TextPicker({<br \/>\n          range: this.months,<br \/>\n          selected: this.monthIndex<br \/>\n        })<br \/>\n        .onChange((value: string, index: number) &#061;&gt; {<br \/>\n          this.monthIndex &#061; index;<br \/>\n        })<\/p>\n<p>        \/\/ \u65e5\u9009\u62e9<br \/>\n        TextPicker({<br \/>\n          range: this.days,<br \/>\n          selected: this.dayIndex<br \/>\n        })<br \/>\n        .onChange((value: string, index: number) &#061;&gt; {<br \/>\n          this.dayIndex &#061; index;<br \/>\n        })<br \/>\n      }<\/p>\n<p>      Text(&#096;\u60a8\u9009\u62e9\u7684\u65e5\u671f\u662f: ${this.years[this.yearIndex]}${this.months[this.monthIndex]}${this.days[this.dayIndex]}&#096;)<br \/>\n        .margin({ top: 30 })<br \/>\n    }<br \/>\n    .width(&#039;100%&#039;)<br \/>\n    .padding(20)<br \/>\n  }<br \/>\n} <\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb70\u6b21\u3002\u672c\u6587\u4ecb\u7ecd\u4e86HarmonyOS\u4e2dTextPicker\u7ec4\u4ef6\u7684\u4f7f\u7528\u65b9\u6cd5\u548c\u81ea\u5b9a\u4e49\u6280\u5de7\u3002\u4e3b\u8981\u5185\u5bb9\u5305\u62ec\uff1a1\uff09\u57fa\u7840\u7528\u6cd5\uff0c\u5c55\u793a\u5982\u4f55\u8bbe\u7f6e\u6570\u636e\u6e90(range)\u3001\u9ed8\u8ba4\u9009\u4e2d\u9879(selected\/value)\u53ca\u4e8b\u4ef6\u5904\u7406\uff1b2\uff09\u6837\u5f0f\u5b9a\u5236\uff0c\u901a\u8fc7textStyle\u3001selectedTextStyle\u7b49\u5c5e\u6027\u81ea\u5b9a\u4e49\u6587\u672c\u6837\u5f0f\uff0c\u4ee5\u53ca\u8c03\u6574\u9009\u9879\u9ad8\u5ea6(defaultPickerItemHeight)\u548c\u53ef\u89c1\u6570\u91cf(itemSize)\uff1b3\uff09\u591a\u5217\u9009\u62e9\u5668\u5b9e\u73b0\uff0c\u6f14\u793a\u4e86\u7701\u4efd-\u57ce\u5e02\u8054\u52a8\u9009\u62e9\u5668\u548c\u65e5\u671f\u9009\u62e9\u5668\u7684\u5f00\u53d1\u65b9\u6cd5\u3002\u6587\u4e2d\u63d0\u4f9b\u4e86\u5b8c\u6574\u7684\u4ee3\u7801\u793a\u4f8b\uff0c\u5e2e\u52a9\u5f00\u53d1\u8005\u5feb\u901f\u638c\u63e1TextPi<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[280,67,1737],"topic":[],"class_list":["post-57752","post","type-post","status-publish","format-standard","hentry","category-server","tag-harmonyos","tag-67","tag-1737"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u9e3f\u8499\u4e2d \u9009\u62e9\u5668TextPicker\u7ec4\u4ef6 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/57752.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u9e3f\u8499\u4e2d \u9009\u62e9\u5668TextPicker\u7ec4\u4ef6 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb70\u6b21\u3002\u672c\u6587\u4ecb\u7ecd\u4e86HarmonyOS\u4e2dTextPicker\u7ec4\u4ef6\u7684\u4f7f\u7528\u65b9\u6cd5\u548c\u81ea\u5b9a\u4e49\u6280\u5de7\u3002\u4e3b\u8981\u5185\u5bb9\u5305\u62ec\uff1a1\uff09\u57fa\u7840\u7528\u6cd5\uff0c\u5c55\u793a\u5982\u4f55\u8bbe\u7f6e\u6570\u636e\u6e90(range)\u3001\u9ed8\u8ba4\u9009\u4e2d\u9879(selected\/value)\u53ca\u4e8b\u4ef6\u5904\u7406\uff1b2\uff09\u6837\u5f0f\u5b9a\u5236\uff0c\u901a\u8fc7textStyle\u3001selectedTextStyle\u7b49\u5c5e\u6027\u81ea\u5b9a\u4e49\u6587\u672c\u6837\u5f0f\uff0c\u4ee5\u53ca\u8c03\u6574\u9009\u9879\u9ad8\u5ea6(defaultPickerItemHeight)\u548c\u53ef\u89c1\u6570\u91cf(itemSize)\uff1b3\uff09\u591a\u5217\u9009\u62e9\u5668\u5b9e\u73b0\uff0c\u6f14\u793a\u4e86\u7701\u4efd-\u57ce\u5e02\u8054\u52a8\u9009\u62e9\u5668\u548c\u65e5\u671f\u9009\u62e9\u5668\u7684\u5f00\u53d1\u65b9\u6cd5\u3002\u6587\u4e2d\u63d0\u4f9b\u4e86\u5b8c\u6574\u7684\u4ee3\u7801\u793a\u4f8b\uff0c\u5e2e\u52a9\u5f00\u53d1\u8005\u5feb\u901f\u638c\u63e1TextPi\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/57752.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-08-15T10:59:52+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/57752.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/57752.html\",\"name\":\"\u9e3f\u8499\u4e2d \u9009\u62e9\u5668TextPicker\u7ec4\u4ef6 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-08-15T10:59:52+00:00\",\"dateModified\":\"2025-08-15T10:59:52+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/57752.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/57752.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/57752.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u9e3f\u8499\u4e2d \u9009\u62e9\u5668TextPicker\u7ec4\u4ef6\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u9e3f\u8499\u4e2d \u9009\u62e9\u5668TextPicker\u7ec4\u4ef6 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/57752.html","og_locale":"zh_CN","og_type":"article","og_title":"\u9e3f\u8499\u4e2d \u9009\u62e9\u5668TextPicker\u7ec4\u4ef6 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb70\u6b21\u3002\u672c\u6587\u4ecb\u7ecd\u4e86HarmonyOS\u4e2dTextPicker\u7ec4\u4ef6\u7684\u4f7f\u7528\u65b9\u6cd5\u548c\u81ea\u5b9a\u4e49\u6280\u5de7\u3002\u4e3b\u8981\u5185\u5bb9\u5305\u62ec\uff1a1\uff09\u57fa\u7840\u7528\u6cd5\uff0c\u5c55\u793a\u5982\u4f55\u8bbe\u7f6e\u6570\u636e\u6e90(range)\u3001\u9ed8\u8ba4\u9009\u4e2d\u9879(selected\/value)\u53ca\u4e8b\u4ef6\u5904\u7406\uff1b2\uff09\u6837\u5f0f\u5b9a\u5236\uff0c\u901a\u8fc7textStyle\u3001selectedTextStyle\u7b49\u5c5e\u6027\u81ea\u5b9a\u4e49\u6587\u672c\u6837\u5f0f\uff0c\u4ee5\u53ca\u8c03\u6574\u9009\u9879\u9ad8\u5ea6(defaultPickerItemHeight)\u548c\u53ef\u89c1\u6570\u91cf(itemSize)\uff1b3\uff09\u591a\u5217\u9009\u62e9\u5668\u5b9e\u73b0\uff0c\u6f14\u793a\u4e86\u7701\u4efd-\u57ce\u5e02\u8054\u52a8\u9009\u62e9\u5668\u548c\u65e5\u671f\u9009\u62e9\u5668\u7684\u5f00\u53d1\u65b9\u6cd5\u3002\u6587\u4e2d\u63d0\u4f9b\u4e86\u5b8c\u6574\u7684\u4ee3\u7801\u793a\u4f8b\uff0c\u5e2e\u52a9\u5f00\u53d1\u8005\u5feb\u901f\u638c\u63e1TextPi","og_url":"https:\/\/www.wsisp.com\/helps\/57752.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-08-15T10:59:52+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/57752.html","url":"https:\/\/www.wsisp.com\/helps\/57752.html","name":"\u9e3f\u8499\u4e2d \u9009\u62e9\u5668TextPicker\u7ec4\u4ef6 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-08-15T10:59:52+00:00","dateModified":"2025-08-15T10:59:52+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/57752.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/57752.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/57752.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u9e3f\u8499\u4e2d \u9009\u62e9\u5668TextPicker\u7ec4\u4ef6"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/57752","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=57752"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/57752\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=57752"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=57752"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=57752"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=57752"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}