• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • JavaScript
  • ASP.NET
  • PHP
  • 正则表达式
  • AJAX
  • JSP
  • ASP
  • Flex
  • XML
  • 编程技巧
  • Android
  • swift
  • C#教程
  • vb
  • vb.net
  • C语言
  • Java
  • Delphi
  • 易语言
  • vc/mfc
  • 嵌入式开发
  • 游戏开发
  • ios
  • 编程问答
  • 汇编语言
  • 微信小程序
  • 数据结构
  • OpenGL
  • 架构设计
  • qt
  • 微信公众号
您的位置:首页 > 程序设计 >Android > 安卓的主要几大布局,安卓布局

安卓的主要几大布局,安卓布局

作者:网友 字体:[增加 减小] 来源:互联网 时间:2017-05-26

网友通过本文主要向大家介绍了安卓布局,安卓布局详解,安卓线性布局,安卓界面布局,安卓五大布局等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com

安卓的主要几大布局,安卓布局


今天我们的主要内容就是安卓的主要几个基础的布局方式。(主要布局如下:)

1.线性布局(LinerLayout)

2.相对布局(RelativeLayout)

3.表格布局(TableLayout)

4.网格布局(GridLayout)

5.绝对布局(AbsoluteLayout)

6.帧布局(FrameLayout)

一:线性布局(LinerLayout)。

1.xml文件配置:

<?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"
    android:padding="5dp" >

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#0000FF"
        android:gravity="center_horizontal|center_vertical"
        android:text="线性布局"
        android:textSize="20sp"/>

<LinearLayout
    android:layout_width="200dp"
    android:layout_height="150dp"
    android:layout_gravity="center_horizontal|center_vertical"
    android:background="#0000FF"
    android:orientation="horizontal" >

    <TextView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="2"
        android:background="#00FF00"
        android:text="内容一" />

    <TextView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:background="#F7F709"
        android:text="内容二" />

</LinearLayout>
<LinearLayout
    android:layout_width="200dp"
    android:layout_height="150dp"
    android:layout_gravity="right"
    android:background="#0000FF"
    android:orientation="horizontal" >

    <TextView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:background="#00FF00"
        android:text="内容一" />

    <TextView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="2"
        android:background="#F7F709"
        android:text="内容二" />
</LinearLayout>
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal" >
 <Button
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="按一" 
        android:onClick="click"
        />
  <Button
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="按二" 
        android:onClick="click"/>
   <Button
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="按三" 
        android:onClick="click"/>
    <Button
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="按四" 
        android:onClick="click"/>

</LinearLayout>
</LinearLayout>

展示:

2.xml文件配置:

<?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" >

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="20dp"
        android:gravity="center_horizontal|center_vertical"
        android:text="线性布局登录页面"
        android:textSize="20sp" />

    <LinearLayout
        android:layout_width="200dp"
        android:layout_height="40dp"
        android:layout_gravity="center_horizontal|center_vertical"
        android:layout_marginTop="20dp"
        android:orientation="horizontal" >

        <TextView
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="账号:"
            android:textSize="15sp" />

        <EditText
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="4" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="200dp"
        android:layout_height="40dp"
        android:layout_gravity="center_horizontal|center_vertical"
        android:orientation="horizontal" >

        <TextView
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="密码:"
            android:textSize="15sp" />

        <EditText
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="4" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="200dp"
        android:layout_height="30dp"
        android:layout_gravity="center_horizontal|center_vertical"
        android:layout_marginTop="15dp"
        android:orientation="horizontal" >

        <CheckBox
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="记住账号" />

        <CheckBox
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="记住密码" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="200dp"
        android:layout_height="30dp"
        android:layout_gravity="center_horizontal|center_vertical"
        android:layout_marginTop="15dp"
        android:orientation="horizontal" >

        <Button
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:onClick="clic



 
分享到:QQ空间新浪微博腾讯微博微信百度贴吧QQ好友复制网址打印

您可能想查找下面的文章:

  • 安卓的主要几大布局,安卓布局

相关文章

  • 2017-05-26Android pendingInten 用法详解
  • 2017-05-26android:Activity数据传递之基本数据类型
  • 2017-05-26Android应用自定义View绘制方法手册
  • 2017-05-26Android 工程集成React Native 0.44 注意点,androidreact
  • 2017-05-26Yarn上运行spark-1.6.0
  • 2017-05-26Drawable资源的初步使用
  • 2017-05-26Android中的 init.rc文件简介,androidinit.rc
  • 2017-05-26【lushengduan】03、点击事件的四种实现方式,lushengduan03
  • 2017-05-26MotionEvent机制(触屏),motionevent机制
  • 2017-05-26android.invalidate(),android.invalidate

文章分类

  • JavaScript
  • ASP.NET
  • PHP
  • 正则表达式
  • AJAX
  • JSP
  • ASP
  • Flex
  • XML
  • 编程技巧
  • Android
  • swift
  • C#教程
  • vb
  • vb.net
  • C语言
  • Java
  • Delphi
  • 易语言
  • vc/mfc
  • 嵌入式开发
  • 游戏开发
  • ios
  • 编程问答
  • 汇编语言
  • 微信小程序
  • 数据结构
  • OpenGL
  • 架构设计
  • qt
  • 微信公众号

最近更新的内容

    • android:使用gallery和imageSwitch制作可左右循环滑动的图片浏览器
    • Android中使用findViewByMe提升组件查找效率,光伏组件转换效率
    • 客户端和服务端如何使用Token和Session,tokensession
    • Your project path contains non-ASCII characters,containsnon-ascii
    • Linux(CentOS 7)命令行模式安装VMware Tools
    • 仿微信新消息提示音,消息
    • [android] 手机卫士保存安全号码,android卫士
    • Android工程师入门(一)——这周入大门,挤时间,轻喷,android工程师
    • framework层和native层实现联网控制(iptable方式),nativeiptable
    • Android中AlarmManager使用示例(持续更新,已经更改),alarmmanager

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有