as笔记4(从empty actvity的代码书写开始)

今天我开始写activity的代码了,依旧是以那本书和“单刷”为指导


然后发现as在empty activity的创建时出现两个选项,右边的是“向后兼容”,左边是launcher activity选项。

至于这个launcher activity是什么我现在还不知道,不过还是先把资料放上了。以后方便查询。

Launcher与普通Activity的区别

http://blog.csdn.net/linuxheik/article/details/25076177


launcher,也就是Android的桌面应用程序  这位博主对launcher进行了解答

http://blog.csdn.net/mdx20072419/article/details/9632779/


这位大牛的文章《手把手教你launcher》http://blog.csdn.net/chen825919148/article/details/19627635


structs2 教程        http://www.cnblogs.com/xing901022/p/3961661.html


我去。。。还没开始写代码,就有这么多知识点发散出去了,惊了。


http://www.admin10000.com/document/5496.html                           as的使用方法补充


http://www.linuxidc.com/Linux/2015-09/123278.htm  文章中讲到

1 创建工程

使用Android Studio创建一个LinerLayout工程,使用Blank Activity。

2 修改布局文件

创建工程后,res/layout下已经自动生成activity_liner_layout.xml,使用的是RelativeLayout布局。

要使用LinerLayout,需要先把RelativeLayout删除,然后添加:

<LinerLayout></LinerLayout>

从Text模式切换到Design模式,提示“Rendering Problem”,告诉你当前layout缺少那些attributes。点击提示,添加属性。

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
   
</LinearLayout>

xmlns(xml namespaces 命名空间)

添加orientation属性,该属性值包括horizontal(水平)和vertical(垂直)。这里方向设置为垂直。

android:orientation="vertical"

到这里线性布局属性已经全部设好了。

接下来该添加控件了,分别把TextView、EditText、Button、Button拖进可视化编辑器里,并修改空间的text和id。

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="请输入"
        android:id="@+id/textView01" />

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/editText01" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="确认"
        android:id="@+id/button01" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="取消"
        android:id="@+id/button02" />
</LinearLayout>

在往可视化编辑器里拖的时候就可以感觉到空间只能垂直向下排列。这就是orientation属性作用的结果。

点击运行按钮,查看运行结果。

更多Android Studio相关内容可以看看以下的有用链接: 

Ubuntu 15.04下安装Android Studio  http://www.linuxidc.com/Linux/2015-06/119318.htm 

Ubuntu 12.04(64位)安装Android Studio 全过程 http://www.linuxidc.com/Linux/2013-05/84812.htm 

Android Studio v0.1尝鲜 http://www.linuxidc.com/Linux/2013-05/84681.htm 

Android Studio使用教程 http://www.linuxidc.com/Linux/2013-05/84579.htm 

Android Studio开发指南 http://www.linuxidc.com/Linux/2013-05/84543.htm

Android Studio设置主题 和 不支持中文的问题解决方法 http://www.linuxidc.com/Linux/2013-05/84488.htm 

Android Studio 下载安装以及不能打开的解决办法 http://www.linuxidc.com/Linux/2013-05/84409.htm 

Android Studio安装使用图文教程 http://www.linuxidc.com/Linux/2014-09/106914.htm 

Ubuntu上安装Android Studio 1.3(谷歌 Android IDE 开发)  http://www.linuxidc.com/Linux/2015-08/121004.htm 

Android Studio 的详细介绍请点这里
Android Studio 的下载地址请点这里 

本文永久更新链接地址http://www.linuxidc.com/Linux/2015-09/123278.htm


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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值