安卓项目笔记1 掷骰子
前言
我通过在网上找到的内容改了改进行编写,我认为编程最重要的就是从项目中去学习,先敲项目,不会的地方再找书,翻搜索,这里我推荐一本书《Android移动应用基础教程(Android Studio)(第二版)》,这本书是黑马程序员编著,在B站上可以找到教程,在以后的日子里面我将会以学校和自己在这本书中学到的东西发布在CSDN上,算是作为自己的思想总结。
实验目的
目的:
通过实验掌握Android应用开发工具的安装和配置,熟练使用该工具,参考我们课堂上讲解的“猜拳”小应用源码,完成一个掷骰子的应用程序。
要求:
1.掌握Android应用开发工具(Eclipse或者Android Studio)的安装;
2.熟悉Android应用开发IDE的常规用法;
3.理解Android应用开发的步骤及Android应用程序结构。
相关链接:
AppCompatActivity内部生成AppCompatView源码阅读:https://blog.csdn.net/xingzhong128/article/details/81539576
Android开发者珍藏必备【学习资料篇】:https://blog.csdn.net/ming_147/article/details/80346555
注:图片一般存放在项目-res-drawable-xxx下,这个xxx(分辨率)有:hdpi.ldpi.mdpi.xhdpi.xxhdpi。图片一般是png格式的。
XML文件
android:id="@+id/button1" //id: button1 ==@+id/button1
//布局layout(按钮大小:width、height、按钮外边距margin:marginStart、marginLeft、marginTop、marginEnd、marginRight)
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="40dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
//按钮文本名text
android:text="start"
app:layout_constraintEnd_toStartOf="@+id/button2"
app:layout_constraintStart_toStartOf="parent"
//constraintTop_toBottomOf+id+id名
app:layout_constraintTop_toBottomOf="@+id/imageView1"
注释:
- wrap_content自适应大小,强制性地使视图扩展以便显示其全部内容。以TextView和ImageView控件为例,wrap_content将完整显示其内部的文本和图像。布局元素将根据内容更改大小。
链接:
- http://blog.csdn.net/qinjuning
- 关于ConstraintLayout的部分属性总结ÿ