Android学习笔记点滴:UI布局

最近在学习android开发的一些基础知识,当然跟大多数小白一样,都是喜欢去Google搜索一下xxx学习教程或者xxx什么的,不过经过一点小的甄选,感觉csdn推荐的<第一行代码>这本书还比较不错,挺适合我这种菜鸟加小白的。从今天开始,会坚持写一些关于学习过程中的点滴,先从android app的脸蛋UI布局开始吧. Android常用的UI布局应该有LinerLayout(线性布局),RelativeLayout(相对布局)FrameLayout(帧布局)TableLayout(表格布局) 从Google的api guides里面就可以看到,基本常用的还是Linear layout和Relativelayout 以写的一个小的activity跳转的程序界面为例 MainActivity是相对布局,跳转后的SettingActivity是线性布局

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.example.context.MainActivity" >

    <TextView
        android:id="@+id/tiaozhuan"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="跳转到设置程序"
        android:textSize="12sp" />

    <Button
        android:id="@+id/button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/tiaozhuan"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="30dp"
        android:gravity="center"
        android:textSize="13sp"
        android:text="打开设置" />

</RelativeLayout>

这里写图片描述

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <Button
        android:id="@+id/buttton01"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:text="设置"
        android:textSize="12sp" />

    <Button
        android:id="@+id/buttton02"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:text="视频通话"
        android:textSize="12sp" />

    <Button
        android:id="@+id/buttton03"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:text="个人中心"
        android:textSize="12sp" />

    <Button
        android:id="@+id/buttton04"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:text="K故事"
        android:textSize="12sp" />

    <Button
        android:id="@+id/buttton05"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:text="小视频"
        android:textSize="12sp" />

    <Button
        android:id="@+id/buttton06"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:text="哄娃助手"
        android:textSize="12sp" />

    <Button
        android:id="@+id/buttton07"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:text="返回"
        android:textSize="12sp" />



</LinearLayout>

这里写图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值