Android随笔01

通讯机制

  1. 1G(Generation):仅限语音的蜂窝电话标准,只能在一定频率上进行通话,容易被窃听.代表是大哥大
  2. 2G:手机使用 PHS,GSM 或者 CDMA 这些十分成熟的标准,具有稳定的通话质量和合适的待机时间,支持彩信业务的 GPRS 和上网业务的 WAP 服务,以及各式各样的 Java 程序等,代表小灵通
  3. 3G:将无线通信与国际互联网等多媒体通信结合的新一代移动通信系统
  4. 4G:该技术包括 TD-LTE 和 FDD-LTE 两种制式.LTE是Long Term Evolution的缩写.4G 是集 3G 与 WLAN 于一体,并能够传输高质量视频图像.4G 理论上可以达到 100Mbps 的下载速度

Android系统架构

应用程序层

该层不仅包括系统内置的应用也包括用户自己安装的应用

应用程序框架层

Android 系统中的每个应用都依赖于该框架提供的一系列服务和系统,其中包括:
1.活动管理器( Activity Manager) :用来管理应用程序生命周期并提供常用的导航回退功能
2. 丰富而又可扩展的视图(Views):可以用来构建应用程序, 它包括列表(lists),网格(grids),文本框(textboxes),按钮(buttons),甚至可嵌入的web 浏览器。
3. 内容提供器(Content Providers):使得应用程序可以访问另一个应用程序的数据(如联系人数据库), 或者共享它们自己的数据。
4. 资源管理器(Resource Manager):提供非代码资源的访问,如本地字符串,图形,和布局文件( layoutfiles )。
5. 通知管理器(Notification Manager):使得应用程序可以在状态栏中显示自定义的提示信息。

系统运行库层

该层主要分为Libaries程序库和Android Runtime库

Linux内核层

Android 的核心系统服务依赖于 Linux 内核,如安全性,内存管理,进程管理,网络协议栈和驱动模型。Linux 内核也同时作为硬件和软件栈之间的抽象层。

两种虚拟机的比较

Java程序员使用的是Java Virtual Machine(JVM),而我们Android使用的是Dalvik Virtual Machine(DVM);JVM执行的是.class文件,而DVM执行的是.dex文件;Dalvik 基于寄存器,而JVM 基于栈。

Android的五大布局

Android 有5 大布局,分别是RelativeLayout、LinearLayout、FrameLayout、AbsoluteLayout、TableLayout。不过前3 种布局才是最常用的布局,AbsoluteLayout 已经被Google 废除,TableLayout 可以被GridView 替代,因此也很少用.

线性布局LinearLayout

案例:
这里写图片描述

<?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" >
    <EditText 
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="number"/>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="MC" />

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="MR" />

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="MS" />

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="M+" />

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="M-" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="←" />

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="CE" />

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="C" />

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="+-" />

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="√" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="7" />

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="8" />

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="9" />

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="/" />

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="%" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="4" />

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="5" />

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="6" />

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="8" />

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="1/x" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

        <LinearLayout
            android:layout_width="0px"
            android:layout_height="wrap_content"
            android:layout_weight="4"
            android:orientation="vertical" >

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal" >

                <Button
                    android:layout_width="0px"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:text="1" />

                <Button
                    android:layout_width="0px"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:text="2" />

                <Button
                    android:layout_width="0px"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:text="3" />

                <Button
                    android:layout_width="0px"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:text="-" />
            </LinearLayout>


            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal" >
                <Button
                    android:layout_width="0px"
                    android:layout_height="wrap_content"
                    android:layout_weight="2"
                    android:text="0" />

                <Button
                    android:layout_width="0px"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:text="." />

                <Button
                    android:layout_width="0px"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:text="+" />
            </LinearLayout>
        </LinearLayout>

        <Button
            android:layout_width="0px"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:text="=" />
    </LinearLayout>

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值