TextView
- android:gravity="center"居中对齐 //文字对齐方式
top bottom left right center
- android:textSize="24sp"
android:textColor="#ffffff"
Button
- textAllCaps="false"禁止自动转换为大写
EditText 输入框
- hint="Type something here" 提示文字
- maxLines="2" 最大行数 当超过两行时 出现滚动条
imageView
- 图片放在drawable里
- src="@drawable/img_1"
ProgressBar 进度条
- visibility:visible invisible gone //不占用空间
- progressBar.getVisibility()
- progressBar.setVisibility(View.VISIBLE INVISIBLE GONE)
- style =" >android:attr/progressBarStyleHorizontal" //水平进度条 默认为圆形进度条
- max=“100”//进度条长度
- 改变进度条的长度
int progress=progressBar.getProgress(); progress=progress+10; progressBar.setProgress(progress1;)
AlertDialog 确认对话框
- 直接在代码中实现
AlterDialog.Builder dialog=new AlterDialog.Builder(MainActivity.this);
dialog.setTitle("This is Dialog")
dialog.setMessage("something important")
dialog.setCancelable(false)//需要用dissmiss来关闭对话框
dialog.setPositiveButton("OK",new DialogInerface.OnClickListener())
{
}
dialog.setNegativeButton(){}
dialog.show();
ProgressDialog//显示等待进度条
代码与上面的类似
布局
线性布局LinearLayout
- orientation:vertical/horizontal 排列方向
- layout_gravity="top center_vertical bottom" 排列对齐方式
- layout_weight=1 一行的屏幕占比
相对布局RelativeLayout
p100
帧布局FrameLayout
百分比布局PercentLayout
ConstraintLayout
https://blog.csdn.net/guolin_blog/article/details/53122387