- 浏览: 5132891 次
- 性别:
- 来自: 天津
博客专栏
-
实战 Groovy
浏览量:29021
文章分类
- 全部博客 (639)
- 代码之谜 (6)
- JavaScript quirks (5)
- 程序员 (92)
- Java (93)
- BT编程 (7)
- html/css (64)
- Groovy&Grails (42)
- Android (20)
- C/C++ (5)
- PHP/Perl/Python (46)
- 经典文章 (51)
- CodeIgniter (14)
- JQuery (10)
- 笑话 (4)
- 其他 (32)
- javascript (69)
- 云计算 (0)
- html5 (7)
- 面试 (8)
- google (3)
- nosql (2)
- nodejs (11)
- go (5)
- erlang (1)
- 小常识 (3)
- 冷知识 (5)
- database (4)
- web (12)
- 架构 (12)
- Exception (0)
最新评论
-
jqw1992:
https://www.chromefor.com/libra ...
[福利] 开发者必备的 Chrome 插件——ChromeSnifferPlus -
litjerk:
初步算了一下,目前最最精简的Win98版是5M,他5个小时多敲 ...
让人目瞪口呆的三位世界级电脑大师 -
379855529:
。。似乎重点没说NIO啊,前面基础只是铺垫的很好的,可是我要的 ...
Java NIO与IO的详细区别(通俗篇) -
springmvc_springjpa:
spring mvc demo教程源代码下载,地址:http: ...
一步步开发 Spring MVC 应用 -
匡建武:
Good
四个程序员的一天
先说说整个程序要做哪些内容吧,简单helloword 通过一个按钮点击在另一个acitvity出现文本Hello xiaoshengDAI
具体包结构如下图
说下做的步骤吧:
1.首先新建项目,我这边主要是测试Layout所以项目名就叫这个了。
2.我们要显示一个按钮,难后点击这个按钮就转到其他activity显示Hello xiaoshengDAI,新建类Layout主要来显示第一个activity即button,
1).在main.xml文件中进行配置
Java代码
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent">
- <Button android:id="@+id/button1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="来点我吧"/>
- </LinearLayout>
2).设置监听和跳转actiovity
Java代码
- package com.layout;
- import android.app.Activity;
- import android.content.Intent;
- import android.os.Bundle;
- import android.view.View;
- import android.view.View.OnClickListener;
- import android.widget.Button;
- public class Layout extends Activity {
- /** Called when the activity is first created. */
- @Override
- public void onCreate(Bundle savedInstanceState) {
- OnClickListener listener1 = null;
- Button botton1 = null;
- listener1 = new OnClickListener(){
- public void onClick(View v) {
- Intent intent0 = new Intent(Layout.this,ActivityFrameLayout.class);
- setTitle("FrameLayout");
- startActivity(intent0);
- }
- };
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
- botton1 = (Button) findViewById(R.id.button1);
- botton1.setOnClickListener(listener1);
- }
- }
3.新建activityFrameLayout类和activityFrameLayout.xml文件
Java代码
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- >
- <TextView
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="Hello xiaoshengDAI"
- />
- </LinearLayout>
Java代码
- package com.layout;
- import android.app.Activity;
- import android.os.Bundle;
- public class ActivityFrameLayout extends Activity {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setTitle("哈哈");
- setContentView(R.layout.activityframelayout);
- }
- }
4.对AndroidManifest.xml进行配置,将新建Activity配置文件加进来
Java代码
- <?xml version="1.0" encoding="utf-8"?>
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.layout"
- android:versionCode="1"
- android:versionName="1.0">
- <application android:icon="@drawable/icon" android:label="@string/app_name">
- <activity android:name=".Layout"
- android:label="@string/app_name">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- <activity android:name=".ActivityFrameLayout" android:label="activityFrameLayout">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- </application>
- <uses-sdk android:minSdkVersion="3" />
- </manifest>
5.可以运行了,嘿嘿
发表评论
-
移动网页设计相关原则
2012-07-25 08:55 1076如何开始移动设计 对于我们中很多人来说,移动端设计是一个崭新的 ... -
10个常见的 Android 新手误区
2012-07-16 08:06 1696在过去十年的移动开发平台中,作为资深的移动开发人员,我们认为A ... -
Android手机内存的运行机制
2012-05-28 09:31 1565使用android手机的用户可能都安装了任务管理的软件,使用a ... -
android应用程序基本原理
2012-05-28 09:30 1781android应用程序是用Java ... -
最封闭的开源系统:话说 Android 的八宗罪
2010-07-16 17:53 2025你以为 Android 是开放的吗?Google 采用了一系 ... -
编写高效的Android代码
2010-06-26 10:48 1509虽然如此说,但似乎并没有什么好的办法:Android设备是 ... -
Android下的多线程
2010-06-26 10:47 3553在Android下面也有多线程的概念,在C/C++中,子线 ... -
android 机器人:应用程序Manifest介绍
2010-06-25 15:43 2243每一个Android应用程 ... -
android 机器人:Styles和Themes(主题和风格)
2010-06-25 11:00 1413Styles和Themes 通过指定Views ... -
android 机器人:Animations
2010-06-25 11:00 2520Animations Android支持2种类 ... -
Android 机器人:使用系统资源
2010-06-25 10:59 1569Android本体应用程序具体化了很多自己的资源,各种 ... -
Android:实时改变配置
2010-06-25 10:59 2586Android通过终止、重 ... -
Android:Layouts介绍
2010-06-24 08:46 3243Layout管理器(一般称“layouts”)是Vie ... -
Android菜单系统介绍
2010-06-24 08:46 2131如果你曾经尝试用手写笔或轨迹球来导航移动电话的菜单系统 ... -
Android使用Intent Filter来响应隐式Intent
2010-06-24 08:45 3950如果一个Intent请求在一片数据上执行一个动作,An ... -
Android如何解析Intent Filter
2010-06-24 08:45 2163匿名性质的运行时绑定使得理解Android如何解析一个 ... -
android.app.Activity 的介绍
2010-06-23 08:53 10998发现当前Android的资料不是很多,而且对于Acti ... -
android sdk+eclipse+adt 配置与开发
2010-06-23 08:52 2843Android ADT插件配置 创建a ... -
Android概述
2010-06-23 08:52 21221. Android是什么? ...
相关推荐
android helloword
第一个Android程序 HelloWord.zip
android入门示例,讲解了从strings.xml配置文件中读取变量显示在界面上,在界面上显示helloworld以及代码入口的基础
Android基础——Android Studio2.1配置NDK运行HelloWord
springboot入门helloworld教程;springboot自带tomcat所以IDEA打包无法启动本篇code重点描述tomcat外置启动。
android系统helloword。初学者使用。
arcgis forandroid helloword 。 第一个程序!
arcgis for android helloword demo 一个非常简单的arcgis demo 本人测试成功上传的 异常花费了本人一上午时间
android 平台下的helloword源代码,非常适合对于android有兴趣的开发人员使用
初学者入门,这是一个非常非常简单的代码,适合没学过计算机语言的学者学习。
Android环境搭配及简单HelloWord 做为入门者不得不看的教程
android jni例程,主要是环境的配置,在android studio2.3.3调试通过
自己搭建的android 开发环境 做的一个模拟器
Android环境搭配及简单HelloWord,入门新手手把手教你搭建android开发平台
Android HelloWord code 初学者可以跑一下
helloword
gef的入门程序helloword 详细讲解说明见博客 http://blog.csdn.net/wm198966/article/details/9813615
spark-windows helloword入门例子 spark-windows helloword入门例子
NULL 博文链接:https://hbiao68.iteye.com/blog/1546980