class mainactivity :()
mtexttospeech.
speak
("哪個字是$text"
, texttospeech.queue_flush,
null)}
textview1.
setonclicklistener
catch
(e:exception)
} textview2.
setonclicklistener
catch
(e:exception)
} textview3.
setonclicklistener
catch
(e:exception)
} textview4.
setonclicklistener
catch
(e:exception)}}
//隨機4個字的方法
funrandomtextview()
//判斷選的對不對
funjudge
(textview: textview)
string1 == string2 ->
//點哪個字,告訴讀什麼
else
-> mtexttospeech.
speak
("這個字是$string1"
, texttospeech.queue_flush,
null)}
}}
activity_main.xml
如下
<?xml version="1.0" encoding="utf-8"?>
xmlns:android
=""=""
xmlns:tools
=""android:layout_width
="match_parent"
android:layout_height
="match_parent"
android:background
="@drawable/beijing"
tools:context
=".mainactivity"
>
android:id
="@+id/guideline4"
android:layout_width
="wrap_content"
android:layout_height
="wrap_content"
android:orientation
="horizontal"
="parent"
="0.500684"
="parent"
/>
android:id
="@+id/guideline"
android:layout_width
="wrap_content"
android:layout_height
="wrap_content"
android:layout_marginstart
="205dp"
android:layout_marginend
="206dp"
android:orientation
="vertical"
="parent"
="0.50121653"
="parent"
/>
android:id
="@+id/textview1"
android:layout_width
="wrap_content"
android:layout_height
="wrap_content"
android:text
="大"
android:textcolor
="#020202"
android:textsize
="100sp"
="@+id/guideline4"
="@+id/guideline"
="parent"
="parent"
/>
android:id
="@+id/textview2"
android:layout_width
="wrap_content"
android:layout_height
="wrap_content"
android:text
="小"
android:textcolor
="#020202"
android:textsize
="100sp"
="@+id/guideline4"
="parent"
="@+id/guideline"
="parent"
/>
android:id
="@+id/textview3"
android:layout_width
="wrap_content"
android:layout_height
="wrap_content"
android:text
="多"
android:textsize
="100sp"
android:textcolor
="#020202"
="parent"
="@+id/guideline"
="parent"
="@+id/guideline4"
/>
android:id
="@+id/textview4"
android:layout_width
="wrap_content"
android:layout_height
="wrap_content"
android:text
="少"
android:textcolor
="#020202"
android:textsize
="100sp"
="parent"
="parent"
="@+id/guideline"
="@+id/guideline4"
/>
android:id
="@+id/button"
style
="@style/widget.materialcomponents.button.unelevatedbutton
" android:layout_width
="wrap_content"
android:layout_height
="wrap_content"
android:paddingleft
="4dp"
android:paddingright
="4dp"
android:text
="提問"
android:textsize
="30sp"
="82dp"
="parent"
="parent"
="parent"
="parent"
/>
androidx.constraintlayout.widget.constraintlayout
>
程式介面如下
理論小知識 字串型別
字串型別指char varchar binary varbinary blob text enum和set。該節描述了這些型別如何工作以及如何在查詢中使用這些型別。型別 大小 用途 char 0 255位元組 定長字串 varchar 0 65535 位元組 變長字串 tinyblob 0 255位...
理論小知識 字串 set命令
1 set key value ex 過期秒數 px 過期毫秒數 nx xx ex second 設定鍵的過期時間為 second 秒。set key value ex second 效果等同於 setex key second value px millisecond 設定鍵的過期時間為 mill...
小程式練習,仿bilibili小程式
開發文件 圖示庫 iconfont 阿里巴巴向量圖示庫 這個是 簡直是神器,什麼圖示都能找到,我很喜歡。utils util.js pages common header.wxml item.wxml index index.js index.wxml index.wxss selectcolor ...