zoukankan      html  css  js  c++  java
  • 忙碌的一天

    一天的工作时间又要过去了,感觉今天过的好快,今天开始android开发的第一个小型项目,主要是根据网上的资源自己略略的改了改,呵呵..挺开心的,一天充实有忙碌着,先把几个知识点总结如下:

    1、对于android的每一个activity都应该在AndroidManifest页面中注册,注册该页面的生成类

    <activity android:name=".SecondDemo"
    android:label="功能列表"> 其中label标签为项目页面的标题

    name为页面的生成类名称

    2、页面采用LinearLayout布局的方法

    几个知识点: <LinearLayout
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="center_horizontal"
    >

    gravity属性表示改项中里面子控件的布局方式;可以居左、居右、居底...

    这里面的高度和宽带有几个新的定义单位:sp、dp;一般sp用来定位字体大小;dp定义宽度、高度等

    3、android项目类似MVC项目构架,所以里面的数据的定义在strings.xml中

    4、控件的事件注册是通过后台获取控件然后新建事件定义的,类似于.net委托

    //注册事件
    Button btLogin=(Button)findViewById(R.id.DL);
    btLogin.setOnClickListener(listener);

    //定义事件
    private OnClickListener listener=new OnClickListener()
    {
    @Override
    public void onClick(View v)
    {

    }

    }

    5、提示窗口的呈现

    Toast.makeText( 一般指当前类 ,"提示内容", Toast.LENGTH_SHORT).show();

    6、在android一般采用整体变量,分别写函数的过程,匿名函数不采用

    以上是收获和总结;

    有几个不明白的知识点:

    1、<LinearLayout 中两个控件:TextView和Button,虽然设置了里面的 android:gravity="left"和 android:gravity="right"但不知道什么原因还是不分布到两边暂时未找到答案。

    2、还有Eclipse的几个操作还不熟悉,即android错误的查找..继续努力

    明天继续,给自己一个励志格言:天行健、以自强不息、地势坤、以厚德载物

                                                                                                                                                          2011年8月23日

  • 相关阅读:
    Android Programming: Pushing the Limits -- Chapter 7:Android IPC -- ApiWrapper
    Android Programming: Pushing the Limits -- Chapter 7:Android IPC -- Messenger
    Android Programming: Pushing the Limits -- Chapter 7:Android IPC -- AIDL
    Android Stutio -- 编译报错: Error:File path too long on Windows, keep below 240
    Android -- 手势操作识别
    Android -- 屏幕适配
    Android -- android:configChanges
    Java -- Date相关
    Java -- File
    links
  • 原文地址:https://www.cnblogs.com/zhijianliutang/p/2151080.html
Copyright © 2011-2022 走看看