Androidでおみくじアプリ作った!
Androidでおみくじアプリを作ろう 終了
Viewは呼び出して表示する機能ってことを理解して、
android:text="@string/score_label"
String.xmlに表示する文字はまとめてスッキリさせるということがわかりました!
public void Uranau(View view){
TextView tv = (TextView)findViewById(R.id.myTextView);
String[] results = {
"大吉",
"吉",
"凶"
};
Random randomGenerator = new Random();
int num = randomGenerator.nextInt(results.length);
if (num == 0) {
tv.setTextColor(Color.rgb(127, 255, 0));
}else{
tv.setTextColor(Color.rgb(0,0,0));
}
tv.setText(results[num]);
}