想知道学习android系统学习游戏特效的地方

[上述的这些种种,其实早已也是内页公开的秘密,是APP和移动互联网最基本的“潜规则”
[无论是在屏幕更小的Nexus 5上面,还是在大屏Nexus 6上面,Android 5.0对谷歌乃至整个
巴士招聘专区
精选推荐Android代码下载最新上线周德群xuweilinjijis2xuweilinjijis2xuweilinjijis2xuweilinjijis2gcl916gcl916gcl916gcl916榜单丨2014.11第①期API_Cloudedugood影子猎手沙漠狼王01沙漠狼王01沙漠狼王01bibibabibabiqweranlx
UI学院精品推荐UI学院最新上线12-0512-0412-0412-0412-0311-2811-2811-2811-2811-27打榜UI(2014.11第①期)﹏._Kid_ヤjayzhou215tliangtianjayzhou215飒飒xvemars_ma大约在冬Gyajun88996﹏._Kid_ヤ
开发资料库精华推荐Android开发资料库首发12-0512-0512-0512-0512-0512-0512-0512-0512-0512-05资料库榜单ailovezly江北晓风chinoaibusCrystal.轻尘ailovezlyazbs_ttxsuooucrazy_petter
_______旧梦失词
来自: 标签:
_______旧梦失词
来自: 标签:
来自: 标签:
_______旧梦失词
来自: 标签:
来自: 标签:
来自: 标签:
来自: 标签:
来自: 标签:
来自: 标签:
﹏._Kid_ヤ
来自: 标签:
来自: 标签:
tliangtian
来自: 标签:
#OneAPM测试征文#+项目评测之Eclipse+Andro#OneAPM测试征文#没有女友每天都是光棍节,关注“巴士官方新浪微博【第二波】APKBUS4周年沙龙--礼品篇
Powered by8011人阅读
我们知道,进入百度图片后,输入一个关键字后,首先看到的是很多缩略图,当我们点击某张缩略图时,我们就可以进入到大图显示页面,在
大图显示页面,中包含了一个图片画廊,同时当前大图为刚刚我们点击的那张图片。现在我们看看在Android中如何实现类似的效果:
首先,我们需要有一个控件来显示缩略图,这里没有什么比GridView更加合适了。
配置文件如下:
&?xml version=&1.0& encoding=&utf-8&?&
&LinearLayout xmlns:android=&/apk/res/android&
android:orientation=&vertical&
android:layout_width=&fill_parent&
android:layout_height=&fill_parent&
android:id=&@+id/view_photos&
android:layout_width=&fill_parent&
android:layout_height=&fill_parent&
android:layout_marginTop=&10dp&
android:columnWidth=&100dp&
android:numColumns=&auto_fit&
android:horizontalSpacing=&5dp&
android:verticalSpacing=&5dp&
android:listSelector=&@drawable/frame_select& /&
&/LinearLayout&
对于GridView中每一项是一张缩略图,我们需要继承BaseAdapter,实现自己的一个GridImageAdapter,代码:
package com.liner.
import java.util.L
import com.liner.manager.adapter.GridImageA
import android.app.A
import android.graphics.B
import android.os.B
import android.view.V
import android.widget.AdapterV
import android.widget.G
import android.widget.ImageB
import android.widget.AdapterView.OnItemClickL
public class GalleryActivity extends Activity{
private ImageButton currentI
private int[] thumbI
private int currentP
private Bitmap currentB
private List&Bitmap& bitmapC
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.gallery);
currentImage = (ImageButton)this.findViewById(R.id.image_current);
gallery = (Gallery)this.findViewById(R.id.image_gallery);
gallery.setOnItemClickListener(galleryItemClickListener);
private OnItemClickListener galleryItemClickListener = new OnItemClickListener() {
public void onItemClick(AdapterView&?& p, View v, int position,
long id) {
// 点击事件
showCurrentImage(position);
private void init(){
thumbIds = this.getIntent().getIntArrayExtra(&thumbIds&);
currentPos = this.getIntent().getIntExtra(&currentPos&,0);
//galleryIds = this.getThumbnailIds(currentPos); //当前的gallery里的图片信息
bitmapCache = BitmapUtils.queryThumbnailListByIds(this, thumbIds);
GridImageAdapter adapter = new GridImageAdapter(this.getApplication(), bitmapCache);
gallery.setAdapter(adapter);
gallery.setSelection(currentPos);
showCurrentImage(currentPos);
private void showCurrentImage(int position){
if(currentBitmap != null){
currentBitmap.recycle();
currentBitmap = BitmapUtils.queryImageByThumbnailId(GalleryActivity.this, thumbIds[position]);
if(currentBitmap != null){
currentImage.setImageBitmap(currentBitmap);
//什么都不做
//releaseBitmaps();
* 将Gallery当前可见的显示之前的3张,后3张缓存起来,其余的释放掉,这样是为了放置内存不够用
* 之所以前三张后三张,是为了Gallery可以滑动的更加顺畅
private void releaseBitmaps(){
int start = gallery.getFirstVisiblePosition()-3; //缓存的起始位置
int end = gallery.getLastVisiblePosition()+3; //缓存的结束位置
Bitmap delB
for(int i=0; i& i++){
delBitmap = bitmapCache.get(i);
if(delBitmap != null){
bitmapCache.remove(i);
delBitmap.recycle();
for(int i=end+1; i&bitmapCache.size(); i++){
delBitmap = bitmapCache.get(i);
if(delBitmap != null){
bitmapCache.remove(i);
delBitmap.recycle();
* 获取当前位置的前三个Id和后三个Id
* @param position
private Integer[] getThumbnailIds(int position){
Integer[] ids = new Integer[]{0,0,0,0,0,0,0};
int currPos = 0;
//关于这里的处理,比较复杂
for(int i=3; i&0; i--){
if(position - i &= 0){
currPos = 3-i;
ids[currPos] = thumbIds[position-i];
ids[++currPos] = thumbIds[position]; //当前Id
//currGallerySelection = currP
//这样右边剩下的位置数就是7-currPos-1
for(int i=1; i&=6-currPi++){
if(position+i & thumbIds.length){
ids[currPos+i] = thumbIds[position+i];
然后,我们就可以在Activity中通过查询MediaStore的多媒体图片库来查询所有的图片的缩略图,缩略图所在的位置是:
MediaStore.Images.Thumbnails。Activity代码如下:
package com.liner.
import java.util.ArrayL
import java.util.L
import com.liner.manager.adapter.GridImageA
import android.app.A
import android.content.I
import android.database.C
import android.graphics.B
import android.graphics.BitmapF
import android.net.U
import android.os.B
import android.provider.MediaS
import android.view.V
import android.widget.A
import android.widget.AdapterV
import android.widget.GridV
import android.widget.T
public class MainActivity extends Activity {
private GridView photoV
private GridImageAdapter imageA
private int[] thumbI
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
photoView = (GridView)this.findViewById(R.id.view_photos);
photoView.setOnItemClickListener(photoClickListener);
//showImages();
showThumbnails();
private void showThumbnails(){
cursor = BitmapUtils.queryThumbnails(this);
if(cursor.moveToFirst()){
List&Bitmap& bitmaps = new ArrayList&Bitmap&();
thumbIds = new int[cursor.getCount()];
for(int i=0; i&cursor.getCount();i++){
cursor.moveToPosition(i);
String currPath = cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Images.Thumbnails.DATA));
thumbIds[i] = cursor.getInt(cursor.getColumnIndexOrThrow(MediaStore.Images.Thumbnails._ID));
Bitmap b = BitmapUtils.decodeBitmap(currPath,100,100);
bitmaps.add(b);
imageAdapter = new GridImageAdapter(this.getApplication(), bitmaps);
photoView.setAdapter(imageAdapter);
private AdapterView.OnItemClickListener photoClickListener = new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView&?& p, View v, int position,
long id) {
//点击某张缩略图时,转到图片显示界面
Intent intent = new Intent();
intent.setClass(MainActivity.this, GalleryActivity.class);
intent.putExtra(&thumbIds&, thumbIds);
intent.putExtra(&currentPos&, position);
startActivity(intent);
注意到,我们记录了,所有缩略图对应的id号,和当前的用户选择的位置,然后通过Intent传递到第二个展示界面。第二个界面的布局文件如下:我们用了一个Gallery和一个ImageButton来实现
&?xml version=&1.0& encoding=&utf-8&?&
&LinearLayout
xmlns:android=&/apk/res/android&
android:layout_width=&fill_parent&
android:layout_height=&fill_parent&
android:orientation=&vertical&&
android:id=&@+id/image_gallery&
android:layout_width=&fill_parent&
android:layout_height=&100dp&
&ImageButton
android:id=&@+id/image_current&
android:layout_width=&fill_parent&
android:layout_height=&fill_parent&
android:padding=&10dp&
android:layout_marginTop=&10dp&
&/LinearLayout&
然后,对应的Activity如下:
package com.liner.
import java.util.L
import com.liner.manager.adapter.GridImageA
import android.app.A
import android.graphics.B
import android.os.B
import android.view.V
import android.widget.AdapterV
import android.widget.G
import android.widget.ImageB
import android.widget.AdapterView.OnItemClickL
public class GalleryActivity extends Activity{
private ImageButton currentI
private int[] thumbI
private int currentP
private Bitmap currentB
private List&Bitmap& bitmapC
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.gallery);
currentImage = (ImageButton)this.findViewById(R.id.image_current);
gallery = (Gallery)this.findViewById(R.id.image_gallery);
gallery.setOnItemClickListener(galleryItemClickListener);
private OnItemClickListener galleryItemClickListener = new OnItemClickListener() {
public void onItemClick(AdapterView&?& p, View v, int position,
long id) {
// 点击事件
showCurrentImage(position);
private void init(){
thumbIds = this.getIntent().getIntArrayExtra(&thumbIds&);
currentPos = this.getIntent().getIntExtra(&currentPos&,0);
//galleryIds = this.getThumbnailIds(currentPos); //当前的gallery里的图片信息
bitmapCache = BitmapUtils.queryThumbnailListByIds(this, thumbIds);
GridImageAdapter adapter = new GridImageAdapter(this.getApplication(), bitmapCache);
gallery.setAdapter(adapter);
gallery.setSelection(currentPos);
showCurrentImage(currentPos);
private void showCurrentImage(int position){
if(currentBitmap != null){
currentBitmap.recycle();
currentBitmap = BitmapUtils.queryImageByThumbnailId(GalleryActivity.this, thumbIds[position]);
if(currentBitmap != null){
currentImage.setImageBitmap(currentBitmap);
//什么都不做
//releaseBitmaps();
可以看到,当用户点击Gallery中某一项时,触发onItemClick事件,在其中,我们通过根据该缩略图对应的Image_ID来从MediaStore.Images.Media中查询该缩略图对应的大图。并在ImageButton中显示。
这里当图片很多时,可能会出现内存溢出,为了避免这种情况,可以更加Gallery的特点,使用缓存。保存当前可见的缩略图的前三个到后三个。其余的全部recycle。当用户点击Gallery的时候,在判断当前的位置,如果大于或小于某个值时,则重新更新缓存。这样保证内存中的缩略图的个数总是6+Gallery.getLastVisiblePosition-Gallery.getFirstVisiblePosition个。其实这就是浮动缓存窗口,一个固定大小窗口在整个坐标(全部缩略图)上游动。这里没有实现,以后待续。
同时,你可能已经注意到,程序中使用到了一个BitmapUtils类,这个类是封装了一系列对查询图片,并将其解析为Bitmap的类。
代码如下:
package com.liner.
import java.util.ArrayL
import java.util.L
import android.app.A
import android.database.C
import android.graphics.B
import android.graphics.BitmapF
import android.provider.MediaS
import android.util.L
public final class BitmapUtils {
public static Bitmap decodeBitmap(String path, int displayWidth, int displayHeight){
BitmapFactory.Options op = new BitmapFactory.Options();
op.inJustDecodeBounds =
Bitmap bmp = BitmapFactory.decodeFile(path, op); //获取尺寸信息
//获取比例大小
int wRatio = (int)Math.ceil(op.outWidth/(float)displayWidth);
int hRatio = (int)Math.ceil(op.outHeight/(float)displayHeight);
//如果超出指定大小,则缩小相应的比例
if(wRatio & 1 && hRatio & 1){
if(wRatio & hRatio){
op.inSampleSize = wR
op.inSampleSize = hR
op.inJustDecodeBounds =
bmp = BitmapFactory.decodeFile(path, op);
return Bitmap.createScaledBitmap(bmp, displayWidth, displayHeight, true);
* 采用复杂计算来决定缩放
* @param path
* @param maxImageSize
public static Bitmap decodeBitmap(String path, int maxImageSize){
BitmapFactory.Options op = new BitmapFactory.Options();
op.inJustDecodeBounds =
Bitmap bmp = BitmapFactory.decodeFile(path, op); //获取尺寸信息
int scale = 1;
if(op.outWidth & maxImageSize || op.outHeight & maxImageSize){
scale = (int)Math.pow(2, (int)Math.round(Math.log(maxImageSize/(double)Math.max(op.outWidth, op.outHeight))/Math.log(0.5)));
op.inJustDecodeBounds =
op.inSampleSize =
bmp = BitmapFactory.decodeFile(path, op);
public static Cursor queryThumbnails(Activity context){
String[] columns = new String[]{
MediaStore.Images.Thumbnails.DATA,
MediaStore.Images.Thumbnails._ID,
MediaStore.Images.Thumbnails.IMAGE_ID
return context.managedQuery(MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI, columns, null, null, MediaStore.Images.Thumbnails.DEFAULT_SORT_ORDER);
public static Cursor queryThumbnails(Activity context, String selection, String[] selectionArgs){
String[] columns = new String[]{
MediaStore.Images.Thumbnails.DATA,
MediaStore.Images.Thumbnails._ID,
MediaStore.Images.Thumbnails.IMAGE_ID
return context.managedQuery(MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI, columns, selection, selectionArgs, MediaStore.Images.Thumbnails.DEFAULT_SORT_ORDER);
public static Bitmap queryThumbnailById(Activity context, int thumbId){
String selection = MediaStore.Images.Thumbnails._ID + & = ?&;
String[] selectionArgs = new String[]{
thumbId+&&
Cursor cursor = BitmapUtils.queryThumbnails(context,selection,selectionArgs);
if(cursor.moveToFirst()){
String path = cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Images.Thumbnails.DATA));
cursor.close();
return BitmapUtils.decodeBitmap(path, 100, 100);
cursor.close();
public static Bitmap[] queryThumbnailsByIds(Activity context, Integer[] thumbIds){
Bitmap[] bitmaps = new Bitmap[thumbIds.length];
for(int i=0; i&bitmaps. i++){
bitmaps[i] = BitmapUtils.queryThumbnailById(context, thumbIds[i]);
* 获取全部
* @param context
public static List&Bitmap& queryThumbnailList(Activity context){
List&Bitmap& bitmaps = new ArrayList&Bitmap&();
Cursor cursor = BitmapUtils.queryThumbnails(context);
for(int i=0; i&cursor.getCount(); i++){
cursor.moveToPosition(i);
String path = cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Images.Thumbnails.DATA));
Bitmap b = BitmapUtils.decodeBitmap(path, 100, 100);
bitmaps.add(b);
cursor.close();
public static List&Bitmap& queryThumbnailListByIds(Activity context, int[] thumbIds){
List&Bitmap& bitmaps = new ArrayList&Bitmap&();
for(int i=0; i&thumbIds. i++){
Bitmap b = BitmapUtils.queryThumbnailById(context, thumbIds[i]);
bitmaps.add(b);
public static Cursor queryImages(Activity context){
String[] columns = new String[]{
MediaStore.Images.Media._ID,
MediaStore.Images.Media.DATA,
MediaStore.Images.Media.DISPLAY_NAME
return context.managedQuery(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, columns, null, null, MediaStore.Images.Media.DEFAULT_SORT_ORDER);
public static Cursor queryImages(Activity context, String selection, String[] selectionArgs){
String[] columns = new String[]{
MediaStore.Images.Media._ID,
MediaStore.Images.Media.DATA,
MediaStore.Images.Media.DISPLAY_NAME
return context.managedQuery(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, columns, selection, selectionArgs, MediaStore.Images.Media.DEFAULT_SORT_ORDER);
public static Bitmap queryImageById(Activity context, int imageId){
String selection = MediaStore.Images.Media._ID + &=?&;
String[] selectionArgs = new String[]{
imageId + &&
Cursor cursor = BitmapUtils.queryImages(context, selection, selectionArgs);
if(cursor.moveToFirst()){
String path = cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA));
cursor.close();
//return BitmapUtils.decodeBitmap(path, 260, 260);
return BitmapUtils.decodeBitmap(path, 220); //看看和上面这种方式的差别,看了,差不多
cursor.close();
* 根据缩略图的Id获取对应的大图
* @param context
* @param thumbId
public static Bitmap queryImageByThumbnailId(Activity context, Integer thumbId){
String selection = MediaStore.Images.Thumbnails._ID + & = ?&;
String[] selectionArgs = new String[]{
thumbId+&&
Cursor cursor = BitmapUtils.queryThumbnails(context, selection, selectionArgs);
if(cursor.moveToFirst()){
int imageId = cursor.getInt(cursor.getColumnIndexOrThrow(MediaStore.Images.Thumbnails.IMAGE_ID));
cursor.close();
return BitmapUtils.queryImageById(context, imageId);
cursor.close();
这样就实现了,类似百度图片浏览的效果。效果图如下:
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:375810次
积分:4514
积分:4514
排名:第2086名
原创:71篇
转载:22篇
评论:391条13769人阅读
前言: 很早以前,就听人说过android以后会火起来,作为一个前瞻性对它有所了解会是一个转型的好机会,javaweb太成熟饱和了,现在市面上各种android手机层出不穷,网上各种android视频连续剧一样跟进,安卓一下子成为了热门话题,刚开始也是出于个人兴趣学的很hi感觉挺容易上手的样子,后来工作中才发现问题很多也很棘手,慢慢的在纠结和痛苦中琢磨出了一些经验和规律!
1.android作为view层,要实现和服务层低耦合,必须使用webservice接口,目前还没有十分完善的插件,曾经试过axis的android包(ksoap2),用了之后感觉非常麻烦,特别是复杂数据类型的传递,而且bug也很多,还要改别人源码,无疑增加团队的学习成本和开发难度,无奈之下自己做了,android端使用Apache的httpclient发送交互请求,定义好xml接口传输数据,接收也是用dom4j解析,经测试在2.2中dom4j支持性很好,2.1少些解析用法不支持,但大部分能用,说到这大家也许懂了,没错后端用的是servlet机制,再利用java反射根据xml文件描述动态调用指定的spring服务和方法,这些已经足够,而且可以完全按自己的方式做更多灵活的扩展,不过后来发现配合Xstream更效率,详情可参考
2.httpclient确实是个好东西,但作为无状态访问协议,http无法保存用户会话信息,于是翻开了axis的源码发现它原来时把用户的首次访问信息保存至特定文件,而后根据心跳机制,定时做校验,茅塞顿开,于是我把用户首次访问信息保存在数据库会话表中,并且写了一个存储过程,定时把会话中登录时间距离当前时间超过30分钟的记录做删除操作,用户每次登录都与会话表进行匹配,没有记录即刻超时强退,这么一来,方便简单多了,那么用户每次访问系统都得在xml文件里带着系统给它的串号,也就是sessionid,才叫一次完整的会话,httpclient的用法可参考
3.android系统画图是个麻烦的活,初期我们小组找遍了所有画图的插件,都是忧喜过半,没有办法找到特别满意的,要么是使用太麻烦,要么是找不到我们要的效果,研究的很累也没头绪,问了一些原先做过j2me老程序员,他们建议如果不是专业做游戏的话,统计图表这些还是借助服务端来做更合适一点,于是我们抛弃了所有的android端画图插件,采用jfreechart在服务端画好,图片http流到手机端显示,当然因为2.1系统不支持flash,也就没考虑在做得更漂亮,图表很直观很清晰.另外也可以使用higcharts,详情可参考:
4.UI是个难点,而且为了适应不同分辨率,之前用px单位很有问题,后来改了dip定位,好了许多,之后大面积使用选项卡样式,统一风格,难点很多,比如给tabhost加样式动态改变效果,按钮透明,listview去横线加箭标加动态发亮加下拉翻页,还有手势滑动,各种各样的widget特效和动画切屏,为了省去弯路,我们反编译了QQ,飞信,58,赶集,飞机票,墨迹天气等所有主流的android布局和美化的用法,吸取不少有用的经验,但是依然感觉布局很难做,美工无法直接介入而且模拟器测试很不给力,没办法只能用真机测ui,不过还是感觉很麻烦每次都得运行起来看,看着编译上传运行的进度条,像我这种急性子真快疯掉,没办法彻底换用乌班图linux64位系统作为开发环境,速度能快不少的.
5.android的客户端更新功能,相信只有做过的才知道其中的辛酸,一要做好断点续传,二要做好数据库的初始化工作,三要做好签名,四要做好版本校验的算法并且能显示动态进度条和百分比,断点续传好做,但是数据库初始化麻烦点,我们的做法是把sqlite库文件直接从raw下拷贝至sd卡中,并设置了sqlite的读取库路径指向它,感觉这样好一点,签名一开始不知道,每次覆盖都提示安装未完成,后来才明白为了保证应用的唯一性,它就像是身份证一样,其他没什么作用,和塞班的签名不是一回事,封装apk必须保证在同一签名文件下才可相互覆盖安装!
6.webview中可以调用后端的java代码,类似dwr功能,不过这个功能一直用的很少,很不稳定,兼容性要考量,android既然提供了那么多的ui控件,就说明webview是无法替代它的,毕竟还需要调用底层服务,webview还是慎用的好,有幸参见过一次移动开发者大会,发现有个公司大力推荐他们的一键发布系统,号称一次开发就可以在wp7、android、ios和web上运行,着实激动一把进去抓住那个讲师就劈头盖脸的问,原来真有人干这种事情,采用html+css做高仿的android界面,彻底替换高成本的android原生系统开发,美其名“html5”app发布,把android
app的开发成本一下子拉低到一个山寨的档次(尽管再无力这种结果在天朝也是必然的),让我们这些辛辛苦苦扣吃android原生代码的人情何以堪,不过还是要多说一句webview套html终归是兔子尾巴长不了,想做精品应用,必须用原生开发。
7.android也应该遵循mvc的编程规范,activity只负责处理跳转,UI,和简单数据校验工作,业务逻辑放置在service类中,sqlite操作稍加封装下,做个类似jdbcUtil的那种模板类,提供增删改查,分页等方法,这样dao操作就完善许多,我想作为java程序员转做android开发,最大的障碍不在框架也不在谷歌sdk中的那些api,而是java基础,通过写程序发现,做手机开发的程序员,基本素质要过硬,尤其在集合,线程,异常,io,http这些要非常透彻,不然一个看似很简单的功能,可能就会写的bug百出,甚至效率很低,可读性差,基本上自己回过头都看不懂自己写的是什么,对接口和抽象类,包括匿名内部类的写法也要炉火纯青,熟悉类包的基本结构,及时对自己完成的功能做代码上的优化和重构,让自己和别人读起来像读诗歌一样,清晰优美,它不像web框架那么成熟,大家都用ssh,都很有规范可循,照着画一般也看不出个人功底来!要做好android开发,java基础必须强,否则只能停留在做一些简单的应用层开发,做IM聊天,断点上传下载,邮件协议,高级UI效果就犯难了!
8.另外地图导航也是一个亮点,现在不管做什么功能都会用到地图导航,吃喝玩乐,用户都想知道在什么地方,目前百度谷歌都推出了android的地图接口,我们用的是arcgis,好在api不多应用也很简单,官方都有现成例子,让我这个arcgis是两把刷子的人都能糊上交差,其他类似百度,高德都有自己的地图api接口,里面定位搜索什么都能做,确实很方便,谷歌自带的定位写起来实在太麻烦,申请key还老半天被天朝和谐,所以很难用。
9.写android代码最大的纠结是测试找bug,模拟器很慢,不管修改什么地方,都要重编译部署,ADT插件经常发生debug失效的情况,想加速开发,首先要将eclipse自动编译关掉,把模拟器中没用的进程杀掉,再把一些没用的手机特效关掉,模块化开发,这样便于将整个方法体切出来放进junit里测试,有一款叫Youwave_Android模拟器,使用速度非常快,如果实在没有真机的情况下可以用它来过渡下,没事还可以多下载些android软件,学习下别人的系统是怎么做的,至少能提高下UI审美,有人提议在linux平台上开发,如果从未使用过最好先别给自己加难度,实在想试推荐使用ubuntu10中文桌面版,虽然速度上是没感觉到快多少,但是确是个逐步锻炼提升自己的好机会,技多不压身!
10.&有些小技巧是挺实用的,一些adb命令肯定要比用adt插件要快,新版的sdk升级包把它放在了platform-tools目录下;模拟器横竖切屏有快捷键ctrl+F11或者小键盘home;如果你debug失灵了尝试在DDMS里把进程杀掉部署重试,如果还不行就只有重启模拟器了;如果突然发现gen目录下怎么也不生成R.java文件了,那就show problems看看工程是不是有error,一般不是包路径有问题就是程序内部布局文件有错误,如果仍然无效,关闭eclipse重新打开就好了,有时候adt就会出现这样的bug;adt插件和sdk升级包是有版本依赖的,如果使用的是8.0以上的adt插件,记住的sdk升级包一定用最新的,否则会报找不到adb命令的错误,不要茫然就升级插件,最新10的插件只能在3.5以上的eclipse上运行,而且它并没有带来多大惊喜,只是支持更高sdk版本罢了;android程序本身也有缺陷,千万不要钻太深和它较劲,走不过去的地方就想其他路绕,只要简约朴实不俗套,程序功能健壮就可以;另外多加几个像EOE,开源中国之类的android开发者论坛社区下源码发帖求助,技术无他,唯手熟尔!
关于论坛和社区里经常有人争论学javaee和android到底哪个好,其实都一样,不都是java语言吗?做android的后端多半也是javaee服务,做javaee的人难免也要会一点android,相互配合调试,如果两者都会就业机会和前景岂不是一片大好,运气好干几年你就升职加薪,当上项目经理,迎娶白富美,甚至成为统领公司技术和业务的CTO了,听起来是不是有点小激动呢?java还是很有前途的
真心希望下次谷歌百度的时候看到的不是一大堆copy粘贴来的hello world例子,而是实实在在的开发者之间共享和传递的经验!
转载请标明出处
欢迎有识之士加入我们的技术交流群:
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:711512次
积分:9492
积分:9492
排名:第541名
原创:193篇
转载:27篇
译文:46篇
评论:1084条
文章:10篇
阅读:14329
文章:21篇
阅读:66532
文章:37篇
阅读:279106
(8)(2)(1)(1)(1)(3)(3)(2)(1)(3)(1)(1)(13)(3)(3)(5)(8)(2)(7)(5)(8)(3)(6)(3)(1)(4)(1)(5)(6)(4)(2)(2)(5)(2)(6)(12)(8)(1)(4)(2)(4)(1)(5)(3)(5)(2)(6)(1)(6)(9)(7)(16)(10)(4)(2)(3)(24)

我要回帖

更多关于 android系统学习 的文章

 

随机推荐