一、线性布局:LinearLayout(水平( horizontal)、垂直(vertical))
1、match_parent:填充整个文本框
2、wrap_content:自适应大小
3、android:gravity=“center”:显示在父框中心,对齐方式
4、marginleft:与左边的距离
5、hint:提示
6、weight:比例
7、TableLayout:表格布局
8、orientation=“vertical”:垂直布局
9、constraintlayout:约束布局
上:底端与中的顶端相平
← 中→:左:左的上端与中的上端相平,有段与终端相平
下
10、Guideline准线(有两种,horizonzontal水平准线,vertival垂直准线)注:要设置成百分比。
二、相对布局:RelativeLayout
1、android:layout_alignParentLeft=“true”
android:layout_alignParentTop=“true”//在界面的左上角
android:layout_centerInParent=“true”//界面最中心
android:layout_above="@+id/button3"
android:layout_toLeftOf="@id/button3"//以按钮3为中心,在按钮3的左上角
三、引用标题栏:(工程文件Three)
1、新建一个xml文件,拖入两个按钮一个TextView,把布局调整好
2、在main_acticity.xml中添加:
3、隐藏原来的标题:
setContentView(R.layout.activity_main);
ActionBar actionBar=getSupportActionBar();
if(actionBar!=null){
actionBar.hide();
}
Android笔记7
最新推荐文章于 2024-07-24 21:35:56 发布