Android初探:GeoQuiz学习 您所在的位置:网站首页 地理知识答题软件 Android初探:GeoQuiz学习

Android初探:GeoQuiz学习

2024-04-09 23:33| 来源: 网络整理| 查看: 265

初学Android,第一个项目:GeoQuiz。

1. 项目演示:

a. 让用户对地理问题作出True/False的回答,并给出提示。

b. 用户不会时,可以作弊

c. 点击作弊后弹出警告

d. 如果用户真的看了答案,给出提示

2. 步骤:

a. 新建一个Android工程(这里用Android Studio实现)

b. 编写界面

一共两个界面:

(0) string.xml (项目中所用到的字符串)

这里将项目中所有要显示的字符串都放在这里,便于以后修改(真实的情况是直接写死在界面的xml里面会有warning,强迫症受不了~)

GeoQuiz True False Correct! Incorrect! Next Prev The Pacific Ocean is larger than the Atlantic Ocean. The Suez Canal connects the Red Sea and the Indian Ocean. The source of the Nile River is in Egypt. The Amazon River is the longest river in the Americans. Lake Baikal is the world\'s oldest and deepest freshwater lake. Cheat! Are you sure you want to do this? Show Answer Cheating is wrong. Current question:\n %1$s \n Answer:\n %2$s

 

(1) activity_quiz.xml (第一个界面)

这里笔者喜欢Android Studio最近默认的constraintLayout,直接对着design视图拖控件就可以了。

对于constraintLayout的详细用法请看这里

xml:喜欢对constraintLayout手写xml的请看这篇文章,下面还是把xml文件贴出来:



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有