随笔分类 -  Android 学习笔记

摘要:OpenGL ES Tutorial for Android– Part II'm going to write a couple of tutorials on using OpenGL ES on Android phones. The theory of OpenGL ES is the same on different devices so it should be quite easy to convert them to another platform.I can't always remember where I found particular info s 阅读全文
posted @ 2011-07-20 21:34 朱旭东 阅读(24044) 评论(3) 推荐(3) 编辑
摘要:开始Android 3D 游戏开发教程– Part I-VI本帖最后由 huzht 于 2010-4-25 07:58 编辑 这几篇Android 3D游戏开发的文章原文出自一位德国人Martin 在droidnova.com写的文章,有lixinso翻译为中文。第一部分首先介绍OpenGL相关的术语,并引导你开始3D开发的第一步。这个关于3D游戏的系列的叫做 Vortex .这个教程主要focus在3D编程上,其他的东西比如菜单和程序生命周期虽然是代码的一部分,但是在这里不会被提到。首先开始介绍OpenGL的术语。 顶点Vertex 顶点是3D空间中的一个点,也是许多对象的基础元素。在Ope 阅读全文
posted @ 2011-07-20 21:28 朱旭东 阅读(3072) 评论(0) 推荐(1) 编辑
摘要:立体package com.sunny;import java.nio.ByteBuffer;import java.nio.ByteOrder;import java.nio.FloatBuffer;import java.nio.ShortBuffer;import javax.microedition.khronos.egl.EGLConfig;import javax.microedition.khronos.opengles.GL10;import android.opengl.GLSurfaceView;public class VortexRenderer implements 阅读全文
posted @ 2011-07-17 15:11 朱旭东 阅读(457) 评论(0) 推荐(0) 编辑
摘要:透视package com.sunny;import java.nio.ByteBuffer;import java.nio.ByteOrder;import java.nio.FloatBuffer;import java.nio.ShortBuffer;import javax.microedition.khronos.egl.EGLConfig;import javax.microedition.khronos.opengles.GL10;import android.opengl.GLSurfaceView;public class VortexRenderer implements 阅读全文
posted @ 2011-07-17 15:11 朱旭东 阅读(417) 评论(0) 推荐(0) 编辑
摘要:增加color modepackage com.sunny;import java.nio.ByteBuffer;import java.nio.ByteOrder;import java.nio.FloatBuffer;import java.nio.ShortBuffer;import javax.microedition.khronos.egl.EGLConfig;import javax.microedition.khronos.opengles.GL10;import android.opengl.GLSurfaceView;public class VortexRenderer i 阅读全文
posted @ 2011-07-17 15:10 朱旭东 阅读(476) 评论(0) 推荐(0) 编辑
摘要:package com.sunny;import android.app.Activity;import android.os.Bundle;public class mainActivity extends Activity { private static final String LOG_TAG=mainActivity.class.getSimpleName(); private VortexView _vortexView; /** Called when the activity is first created. */ @Override public void onCreate 阅读全文
posted @ 2011-07-17 13:39 朱旭东 阅读(858) 评论(0) 推荐(1) 编辑
摘要:在Activity上有两个ImageButton,分别控制播放/暂停、停止。@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); start = (ImageButton) findViewById(R.id.play); stop = (ImageButton) findViewById(R.id.stop); start.setOnClickListener(this); stop.setOn 阅读全文
posted @ 2011-04-20 16:25 朱旭东 阅读(812) 评论(0) 推荐(0) 编辑
摘要:在Activity中设置两个按钮,分别为启动和关闭Service:bt01.setOnClickListener(new Button.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent i = new Intent(mainActivity.this, MyService.class); startService(i); Toast.makeText(mainActivity.this, "Service启动成功", To 阅读全文
posted @ 2011-04-18 20:23 朱旭东 阅读(302) 评论(0) 推荐(0) 编辑
摘要:Intent的功能有:在mainActivity中为按钮1添加监听事件:listener1 = new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent intent1 = new Intent(mainActivity.this, Activity1.class); intent1.putExtra("mainActivity", "这是来自mainActivity的数据"); startActivi 阅读全文
posted @ 2011-04-18 18:09 朱旭东 阅读(2028) 评论(1) 推荐(0) 编辑
摘要:转自:http://blogold.chinaunix.net/u/24632/showart_2320672.html今天开始launcher2分析系列,Launcher2的代码路径为:$ANDROID_SRC/packages/apps/Launcher2项目构成:AndroidManifest.xml 项目Launcher2的描述文件CleanSpec.mk android项目授权文件?NOTICE apache授权协议Android.mk Launcher2编译的makefileMODULE_LICENSE_APACHE2 空文件proguard.flags -keep clashhr 阅读全文
posted @ 2011-04-18 09:41 朱旭东 阅读(2111) 评论(0) 推荐(0) 编辑
摘要:开发android时经常因为无法查看源码而痛苦,有两个原因: 1.源码下载比较麻烦,尤其是在window开发环境 2.eclipse中无法关联源码包 今天给大家分享我的添加源码的经验 前提: 1.版本是android2.0 2.用eclipse的插件ADT开发 1.下载源码包 源码来源:http://rgruet.free.fr/public/ 2.解压源码包 本人的 SDK_HOME = D:\android-sdk-windows 把下载的sources.rar解压到SDK_HOME/platforms/android-2.0下,形成的目录如下 SDK_HOME |--platfo... 阅读全文
posted @ 2011-04-18 09:40 朱旭东 阅读(720) 评论(0) 推荐(0) 编辑
摘要:在进行游戏开发时,需要自定义各种控件和界面。自定义View的使用:绘制屏幕刷新屏幕:后台数据发生了变化,需要开发人员自己刷新屏幕以显示最新数据例子:MyView开发,绘制界面View内容:package com.sunny;import android.content.Context;import android.graphics.Bitmap;import android.graphics.BitmapFactory;import android.graphics.Canvas;import android.graphics.Color;import android.graphics.Pai 阅读全文
posted @ 2011-04-17 21:42 朱旭东 阅读(369) 评论(0) 推荐(0) 编辑
摘要:Intent intent=new Intent(mainActivity.this,mainActivity.class); PendingIntent pi=PendingIntent.getActivity(mainActivity.this, 0, intent, 0); Notification myNotification=new Notification(); myNotification.icon=R.drawable.noti; myNotification.tickerText="点击查看"; myNotification.defaults=Notifi 阅读全文
posted @ 2011-04-17 15:57 朱旭东 阅读(304) 评论(0) 推荐(0) 编辑
摘要:Android平台下对话框主要有普通对话框、选项对话框、单选多选对话框、进度对话框、日期对话框、时间对话框等。在程序中通过开发回调方法onCreateDialog来完成对话框的创建,该方法需要传入代表对话框id参数。如果要显示对话框,则调用showDialog方法传入对话框的id来显示指定对话框。当对话框第一次被显示时,会调用onCreateDialog方法来创建对话框实例,之后将不再重复创建该实例。每次对话框在被显示之前都会调用onPrepareDialog方法,如不重写该方法,每次显示的对话框都将是最初创建的那个。关闭对话框可用dismiss方法实现。但如果需要让对话框在关闭之后彻底被清除 阅读全文
posted @ 2011-04-17 15:39 朱旭东 阅读(2826) 评论(1) 推荐(0) 编辑
摘要:android的菜单主要分三类:选项菜单(Options Menu)、上下文菜单(Context Menu)、子菜单(Submenu)。1 选项菜单和子菜单一个Menu对象代表一个菜单,Menu中可添加菜单项MenuItem,也可以添加子菜单SubMenu。 @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } @Override public boolean onCreateOptionsM 阅读全文
posted @ 2011-04-14 21:21 朱旭东 阅读(956) 评论(0) 推荐(0) 编辑
摘要:TabHost的实现有两种方式,第一种继承TabActivity,从TabActivity中用getTabHost()方法获取TabHost。各个Tab中的内容在布局文件中定义就行了。mainActivity.xmlprivate TabHost myTabHost; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //setContentView(R.layout.main); myTabHost = this.getTabHost(); Layou 阅读全文
posted @ 2011-04-14 17:06 朱旭东 阅读(6371) 评论(0) 推荐(0) 编辑
摘要:GridView 的用法基本与ListView类似。程序布局文件main.xml<?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=&q 阅读全文
posted @ 2011-04-14 13:19 朱旭东 阅读(2028) 评论(0) 推荐(0) 编辑
摘要:ListView是一种列表视图,其将ListAdapter所提供的各个控件显示在一个垂直且可滚动的列表中。需要注意的为创建适配器并将其设置给ListView。1.ArrayAdapterArrayAdapter由3个参数进行构造,第一个为Context,第二个为在R文件中定义的Layout,也可用系统的R文件,第三个参数是一个数组,数组中每一项的类型没有限制。系统默认的布局方式可通过android.R.layout.XX定义。private static String[] data={"a","b","c","d" 阅读全文
posted @ 2011-04-13 22:10 朱旭东 阅读(1043) 评论(1) 推荐(0) 编辑
摘要:1 补间动画在assets/anim下新建补间动画的xml文件tween_ani.xml<?xml version="1.0" encoding="utf-8"?><set xmlns:android="http://schemas.android.com/apk/res/android"> <alpha android:fromAlpha="0.0" android:toAlpha="1.0" android:duration="6000" / 阅读全文
posted @ 2011-04-13 12:28 朱旭东 阅读(1065) 评论(0) 推荐(0) 编辑
摘要:<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> <ImageView android:id="@+id/imageView1" android:layout_width=&quo 阅读全文
posted @ 2011-04-11 21:01 朱旭东 阅读(1734) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示