自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(305)
  • 资源 (3)
  • 收藏
  • 关注

原创 ListView的快速索引

在玩即时通讯app比如微信的联系人列表的时候,发现联系人列表的右侧有个竖排的字母索引,点击字母,可以快速索引到相应的联系人。本篇就是实现这个功能。效果图:快速索引快速索引需要实现:将右侧的字母画到屏幕上去;联系人列表排序;根据联系人名字的首字母为ListView打上TAG选中索引的某个字母,出现相应的TAG下的联系人;画索引字母到屏幕上新建一个类,继承自View

2015-05-08 10:16:59 1220

原创 ActivityLifeCycle官方demo解析

1.关于Activity的生命周期的几篇文章:http://1.duoinfo.sinaapp.com/?p=330http://1.duoinfo.sinaapp.com/?p=332http://1.duoinfo.sinaapp.com/?p=335http://1.duoinfo.sinaapp.com/?p=337training课程给的图是这样的:

2015-03-14 09:19:25 2432

原创 Custom Drawing

Override onDraw()The most important step in drawing a custom view is to override the onDraw() method. The parameter to onDraw() is a Canvasobject that the view can use to draw itself. The Ca

2015-03-11 08:56:19 542

原创 85ViewTreeObserver.addOnGlobalLayoutListener(listener)

有时候需要在onCreate方法中知道某个View组件的宽度和高度等信息,而直接调用View组件的getWidth()、getHeight()、getMeasuredWidth()、getMeasuredHeight()、getTop()、getLeft()等方法是无法获取到真实值的,只会得到0。这是因为View组件布局要在onResume回调后完成。下面提供实现方法,onGlobalLayout

2015-02-02 17:22:42 690

原创 GridView属性集合 drawSelectorOnTop

android:fastScrollEnabled="true"是让ListView出现快速滚动的按钮,一开始,我的记录只有十条,我在拉动的时候都不见出现快速滚动,后来才发现,原因是数据不多的原因,只要数据足够多,才会自动出现的。 还有一个属性:android:drawSelectorOnTopWhen set to true, the selector wil

2015-02-02 15:16:35 870

转载 84Android drawable-nodpi 的作用

把一些不能被拉伸的图片放在 drawable-nodpi 中,此图片将不会被放大,以原大小显示。看下图:drawable-nodpi 的作用" title="Android drawable-nodpi 的作用" style="margin:0px; padding:0px; border:0px; list-style:none">这两个图片被放到了dra

2015-02-02 15:09:25 675

原创 Displaying Bitmap小结

Google的关于展示位图的课程学习完毕了。主要的内容主要包括了下面的几个部分:1.高效的加载大图(Loading Large Bitmaps Efficiently)2.非UI线程处理Bitmap(Processing Bitmaps Off the UI Thread)3.缓存Bitmaps(Caching Bitmaps)(LruCache和DiskLruCache,

2015-02-02 14:42:06 590

原创 Displaying Bitmaps in Your UI

This lesson brings together everything from previous lessons, showing you how to load multiple bitmaps intoViewPager and GridView components using a background thread and bitmap cache, while dealing

2015-02-02 14:40:16 605

原创 Managing Bitmap Memory

In addition to the steps described in Caching Bitmaps, there are specific things you can do to facilitate garbage collection and bitmap reuse. The recommended strategy depends on which version(s) of

2015-02-02 14:39:38 618

原创 Caching Bitmaps

Loading a single bitmap into your user interface (UI) is straightforward, however things get more complicated if you need to load a larger set of images at once. In many cases (such as with components

2015-02-02 14:39:06 550

原创 Processing Bitmaps Off the UI Thread

The BitmapFactory.decode* methods, discussed in the Load Large Bitmaps Efficiently lesson, should not be executed on the main UI thread if the source data is read from disk or a network location (

2015-02-02 14:38:29 679

原创 Loading Large Bitmaps Efficiently

Images come in all shapes and sizes. In many cases they are larger than required for a typical application user interface (UI). For example, the system Gallery application displays photos taken using

2015-02-02 14:36:54 647 1

原创 Displaying Bitmaps Efficiently

Learn how to use common techniques to process and loadBitmap objects in a way that keeps your user interface (UI) components responsive and avoids exceeding your application memory limit. If you’re

2015-02-02 14:35:57 721

原创 contextual action mode

在Google的开发文档的guide的menu里面,提到上下文菜单的两种形式。There are two ways to provide contextual actions:In a floating context menu. A menu appears as a floating list of menu items (similar to a dialog

2015-01-29 10:24:16 980

原创 Android自定义控件—滑动开关

在IM即时通讯的项目中,我用过了滑动开关,那时候,还不会现在这种通过继承View自定义的方式,那时候,我用了两个ImageView通过setVisibility方法去控制的。感觉也挺方便的。(Android4.0有Switch控件,一样的效果)定义一个类继承自View,并实现他的有两个构造函数的方法。执行初始化:public class MyToggleButton extends

2015-01-28 22:21:17 682

原创 Android自定义控件—下拉菜单

效果图:实现思路是:EditText+PopupWindow+ListView(PopupWindow接触的少,注意下他的用法)package com.dystu.edittextdemo;import java.util.ArrayList;import java.util.List;import android.app.Activity;import and

2015-01-28 21:38:23 663

原创 Android自定义控件---广告条滚动

实现后的效果:1.布局:<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:la

2015-01-28 21:21:25 714

原创 Android自定义控件---优酷菜单

实现的效果图:逻辑并不是很难,主要有三点:1.他的布局2.动画的原理3.onkeydown监听menu按键的事件第一个:<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/t

2015-01-28 20:00:44 655

原创 Picker(Time picker&& Date picker)

Android provides controls for the user to pick a time or pick a date as ready-to-use dialogs. Each picker provides controls for selecting each part of the time (hour, minute, AM/PM) or date (month,

2015-01-28 11:35:02 699

原创 EditText的一些属性

我在IM即时通讯项目中,想在输入文字的时候,输入法上面显示发送,然后去响应我的发送消息的事件,但是不知道怎么做,于是我去查下了EdiText的文档(Google  guide),获得了下面的消息:Specifying Keyboard Actions(指定action)In addition to changing the keyboard's in

2015-01-28 10:48:43 806

原创 TextView的一些重要属性

Here are some of the common input type values that define keyboard behaviors:"textCapSentences"Normal text keyboard that capitalizes the first letter for each new sentence.(大写第一个字母)"textCapWords"N

2015-01-28 10:27:52 556

原创 Borderless button

读Google的文档的时候发现的这个,想起来,我之前在即时通讯项目是这样干的,直接在button的xml属性中指定下面的属性:android:background=null;One design that can be useful is a "borderless" button. Borderless buttons resemble basic buttons except

2015-01-28 10:14:09 918

转载 Android 一张图理解getWidth和getMeasuredWidth

一张图理解getWidth和getMeasuredWidth" title="Android 一张图理解getWidth和getMeasuredWidth" style="margin:0px; padding:0px; border:0px; list-style:none">view.getMeasuredHeight()可能隐藏在上头.可能在下头.如果view没有超出屏幕的时候view.

2015-01-27 09:11:06 651

原创 Android获取状态栏,标题栏,视图的尺寸

效果如下:在onWindowFocusChanged方法中执行测量的代码。package com.dystu.viewdimen;import android.app.Activity;import android.graphics.Rect;import android.os.Bundle;import android.view.View;import android

2015-01-27 09:05:28 909

原创 Android JNI开发

什么是JNI:JNI: java本地开发接口, JNI 是一个协议 ,这个协议用来沟通java代码和外部的本地代码(c/c++). 通过这个协议,java代码就可以调用外部的c/c++代码 ,外部的c/c++代码也可以调用java代码。为什么用JNI:JNI扩展了java 虚拟机的能力, 驱动开发 (wifi-hotspot) ,2.3 无线热点共享;Native

2015-01-26 19:51:37 495

转载 83Android实战技巧:深入解析AsyncTask

AsyncTask的介绍及基本使用方法关于AsyncTask的介绍和基本使用方法可以参考官方文档和Android实战技巧:多线程AsyncTask这里就不重复。AsyncTask引发的一个问题上周遇到了一个极其诡异的问题,一个小功能从网络上下载一个图片,然后放到ImageView中,是用AsyncTask来实现的,本身逻辑也很简单,仅是在doInBackground中用HT

2015-01-26 16:00:29 557

原创 82photoview实现多点触控

PhotoView的github地址是:https://github.com/chrisbanes/PhotoView,在我的项目中,当用户发送图片后,点击图片后,进入查看大图片的页面,那么我希望在这个查看大图片的页面能够响应多点触控的事件。所以用到了这个控件。PhotoView的几个特征:Out of the box zooming, using multi-touch and

2015-01-26 15:55:27 727

原创 81ACTION_GET_CONTENT和ACTION_PICK的区别

即时通讯做到选择图片的功能:我是这样处理的: public void selectPicFromLocal() { Intent intent; if (Build.VERSION.SDK_INT < 19) { intent = new Intent(Intent.ACTION_GET_CONTENT); int

2015-01-23 09:34:28 3690

原创 80使用相机录像

请求相机权限(Request Camera Permission)为了让别人知道你的应用依赖照相机,在你的manifest文件中添加标签:<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.dystu.videodemo" android:versionCode

2015-01-22 15:59:40 619

原创 79使用相机拍照

请求使用相机权限(Request Camera Permission)如果拍照是你的应用的必要功能,那么限制它在在Google Play中仅对有相机设备可见。为了让别人知道你的应用依赖照相机,在你的manifest文件中添加标签:<manifest xmlns:android="http://schemas.android.com/apk/res/android" package

2015-01-22 15:39:48 669

原创 高效显示Bitmap3--->Cached Bitmap

加载单个Bitmap到UI是简单直接的,但是如果你需要一次加载大量的图片,事情则会变得复杂起来。在大多数情况下(例如在使用ListView,GridView或ViewPager时), 屏幕上的图片和因滑动将要显示的图片的数量通常是没有限制的。通过循环利用子视图可以抑制内存的使用,GC(garbage collector)也会释放那些不再需要使用的bitmap。这些机制都非常好,但是为了保持一个

2015-01-21 15:51:14 1160

原创 高效显示Bitmap2--->非UI线程处理Bitmap

当数据源是网络或者是磁盘时(或者是任何实际源不在内存的),这些方法都不应该在main UI 线程中执行。那些情况下加载数据是不可以预知的,它依赖于许多因素(从网络或者硬盘读取数据的速度, 图片的大小, CPU的速度, etc.)。如果其中任何一个任务卡住了UI thread, 系统会出现ANR的错误。使用 AsyncTask 在后台线程中处理bitmap并且演示了如何处理并发(concurre

2015-01-21 15:40:19 601

转载 Android事件分发机制

事件分发机制的几个主要的方法:事件分发(dispatchTouchEvent(MotionEvent ev))事件拦截(onInterceptTouchEvent(MotionEvent ev))事件响应(onTouchEvent(MotionEvent ev)),其中ViewGroup响应这三个方法,View要看它是否有子View,没有子View时不响应事件拦截,Activity不响

2015-01-21 14:33:35 965

原创 高效显示Bitmap1--->高效加载大图

当我们使用下面的代码加载内存中的一张图片时,显示了下面的错误:package com.dystu.bitmapdemo;import android.app.Activity;import android.graphics.Bitmap;import android.graphics.BitmapFactory;import android.os.Bundle;import and

2015-01-21 10:17:30 726

原创 Android性能优化典范

我的站点:http://duoinfo.sinaapp.com/  (需要这个模板的问我要吧,我的QQ:619189810)2015年伊始,Google发布了关于Android性能优化典范的专题,一共16个短视频,每个3-5分钟,帮助开发者创建更快更优秀的Android App。课程专题不仅仅介绍了Android系统中有关性能问题的底层工作原理,同时也介绍了如何通过工具来找出性能问题以及提

2015-01-20 18:26:21 924

原创 Google官方demo(displayingBitmaps)

在这个demo里面,他使用的是GridView(在Fragment中)来显示图片的缩略图,当点击缩略图的时候,显示大图,使用了DiskLruCache和AsyncTask。

2015-01-19 10:12:11 1191

原创 使用LayoutAnimationController

结合《第一行代码》的ListView的例子,在ListView的setAdapter方法之前,添加下面的代码:AnimationSet set = new AnimationSet(true); Animation animation = new AlphaAnimation(0.0f, 1.0f); animation.setDuration(300); animation

2015-01-19 09:34:15 601

原创 TextSwitcher的使用

TextSwitcher 字面理解是文字交换器,是ViewSwitcher的子类,从ViewSwitcher来看,是View交换器,TextSwitcher继承自ViewSwitcher,显然是交换TextView。应用分为三步: 1.得到 TextSwitcher 实例对象   TextSwitcher switcher = (TextSwitcher) findViewById(R

2015-01-19 09:08:40 620

原创 使用Preferences

如图,当新建Activity的时候:他的布局在xml文件夹下。

2015-01-17 09:55:17 521

原创 Creating a custom ViewGroup(自定义ViewGroup)

想要实现下面的UI效果:When you’re designing your application, you might have complex views that will show up in different activities. Imagine thatyou’re creating a card game and you want to show the user’s 

2015-01-17 09:24:41 730

Android手机管家项目

Android手机管家项目,很简单,也很粗糙,http://mmdystu.bmob.cn/,欢迎大家和我交流。

2015-01-14

Android组件设计思想

Android组件设计思想,陈述了Activity,Service,BroadcastReceiver,Content Provider为什么这样设计,总之,一切皆组件。

2015-01-05

Volley框架

http://blog.csdn.net/chenfuduo_loveit/article/details/41773607 Android官方的文档,根据官方的文档写出来的代码。

2014-12-08

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除