前面一定要先加入
implements Runnable
public class MainActivity extends AppCompatActivity  implements Runnable{

示範

XML

文章標籤

Saioyan梟夜 發表在 痞客邦 留言(0) 人氣()

String board = Build.BOARD;// 主機版名稱
String brand = Build.BRAND;// 品牌名稱

文章標籤

Saioyan梟夜 發表在 痞客邦 留言(1) 人氣()

Toast toast;

toast=Toast.makeText(this,"早安您好",Toast.LENGTH_LONG);//停留長時間

文章標籤

Saioyan梟夜 發表在 痞客邦 留言(0) 人氣()

ToggleButton toggleButton;

toggleButton=(ToggleButton)findViewById(R.id.toggleButton);

文章標籤

Saioyan梟夜 發表在 痞客邦 留言(0) 人氣()

RadioGroup rg1;

RadioButton rb1;

文章標籤

Saioyan梟夜 發表在 痞客邦 留言(0) 人氣()

CheckBox checkBox;

checkBox=(CheckBox)findViewById(R.id.checkBox);

文章標籤

Saioyan梟夜 發表在 痞客邦 留言(0) 人氣()

ImageView ig1;

ig1=(ImageView)findViewById(R.id.ig1);

文章標籤

Saioyan梟夜 發表在 痞客邦 留言(0) 人氣()

EditText ed1;

ed1=(EditText)findViewById(R.id.ed1);

文章標籤

Saioyan梟夜 發表在 痞客邦 留言(0) 人氣()

Button button;

b1=(Button)findViewById(R.id.b1);

文章標籤

Saioyan梟夜 發表在 痞客邦 留言(0) 人氣()

TextView text;//宣告

text = (TextView)findViewById(R.id.text);

文章標籤

Saioyan梟夜 發表在 痞客邦 留言(0) 人氣()