【Android菜鸟的成长笔记(27)——SurfaceView的使用】教程文章相关的互联网学习教程文章

Android设计模式之单例模式的七种写法【代码】【图】

一 单例模式介绍及它的使用场景单例模式是应用最广的模式,也是我最先知道的一种设计模式,在深入了解单例模式之前,每当遇到如:getInstance()这样的创建实例的代码时,我都会把它当做一种单例模式的实现。其实经常使用的图片加载框架ImageLoader的实例创建就是使用了单例模式,因为这个ImageLoader中含有线程池、缓存系统、网络请求,很消耗资源,不应该创建多个对象,这时候就需要用到单例模式。ImageLoader的创建代码如下:I...

Android:getContext().getSystemService()【代码】【图】

一、介绍getSystemService是Android很重要的一个API,它是Activity的一个方法,根据传入的NAME来取得对应的Object,然后转换成相应的服务对象二、语法WindowManager wm = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE);三、其他服务 原文:https://www.cnblogs.com/hahayixiao/p/10087023.html

Android广播机制的深入学习【代码】

部分内容转载自http://www.cnblogs.com/lwbqqyumidi/p/4168017.html1.Android广播机制概述Android广播分为两个方面:广播发送者和广播接收者,通常情况下,BroadcastReceiver指的就是广播接收者(广播接收器)。广播作为Android组件间的通信方式,可以使用的场景如下:1.同一app内部的同一组件内的消息通信(单个或多个线程之间);2.同一app内部的不同组件之间的消息通信(单个进程);3.同一app具有多个进程的不同组件之间的消息...

【Android】问题待解决……【代码】

Mac 上配置 Android 开发环境,遇到了下面问题:/Users/air/Documents/SVN/Android/26_anfujinrong/1.0.3/res/values/styles.xml:21: error: Error retrieving parent for item: No resource found that matches the given name ‘Theme.Sherlock.Light.NoActionBar‘./Users/air/Documents/SVN/Android/26_anfujinrong/1.0.3/res/values/styles.xml:22: error: Error: No resource found that matches the given name: attr ‘act...

android网络图片加载缓存,避免重复加载。

1.主线程调用方法: imageView = new ImageView(this); AsynImageLoader asynImageLoader = new AsynImageLoader(); asynImageLoader.showImageAsyn(imageView, URL, R.drawable.nopicture); mViewList.add(imageView); 2.AsynImageLoader加载缓存: public void showImageAsyn(ImageView imageView, String url, int resId){ imageView.setTag(url); Bitmap bitmap = loadImageAsyn(url, getImageCallbac...

Android控件之SlidingDrawer(滑动式抽屉)详解与实例【图】

SlidingDrawer效果想必大家也见到过,它就是1.5模拟器上进入应用程序列表的效果。下面是截图 一、简介   SlidingDrawer隐藏屏外的内容,并允许用户通过handle以显示隐藏内容。它可以垂直或水平滑动,它有俩个View组成,其一是可以拖动的handle,其二是隐藏内容的View.它里面的控件必须设置布局,在布局文件中必须指定handle和content.例如下面<SlidingDrawer android:layout_width="fill_parent" android:layout_height="fill_...

Android4.0-Fragment框架实现方式剖析(一)

目录(?)[+] 经过反复的学习对比,个人觉得带着问题学习新知是最有效的学习方式,因此文本就以提问的方式来讲述Fragment框架实现方式。1、什么是Fragment?Fragment包含在Activity中,Fragment只能存在于Activity的上下文(context)内,没有Activity就无法使用Fragment,因此Fragment只能在Activity的上下文(context)创建。Fragment可以作为Activity的一部分,Fragment和Activity非常相似,Fragment拥有一个与她相关的视图层次结...

Android错误之--Error retrieving parent for item: No resource found that matches the given name 'Theme.A【图】

错误提示:error: Error retrieving parent for item: No resource found that matches the given name ‘Theme.AppCompat.Light‘. 如图:解决办法:在建立Android Application的时候,只需要将Minimum Required SDK选择到Android 4.0版本(即API 14),便不会出现烦人的Appcompat_V7内容了。<wbr>parent <wbr>for <wbr>item: <wbr>No <wbr>resource <wbr>found <wbr>that" action-data="http%3A%2F%2Fimg.bbs.csdn.net%2Fupload%...

提高工作效率的16条Android开发小经验

笔者在经历了多个Android开发项目之后,个人积累也从别处学习了很多在Android开发中非常实用的小经验。下面从中选择了最实用的16条,分享给大家。1.TextView中的getTextSize返回值是以像素(px)为单位的,而setTextSize()是以sp为单位的.所以如果直接用返回的值来设置会出错,解决办法是用setTextSize()的另外一种形式,可以指定单位: 1 2 3 4<span style="font-size:16px;">setTextSize(int unit, int size) TypedValue.COMPLEX_...

android 动画属性Animation【代码】【图】

Animation 在android 程序当中很多时候要用到动画效果,而动画效果主要是Animation来实现的,API给出的解释: 其中包含4种动画效果   AlphaAnimation 渐变透明度   RotateAnimation 画面旋转   ScaleAnimation 渐变尺寸缩放   TranslateAnimation 位置移动  但如果你想把这些动画效果联合起来就需要用到一个类AnimationSet 动画集。 下面就对这几个类进行一个简单的解释: AlphaAnimation 的例子:1 Animation ...

Android 扁平化按钮【图】

View创建 colors.xml 文件定义两个颜色1. <resources>2. <color name="blue_pressed">@android:color/holo_blue_dark</color>3. <color name="blue_normal">@android:color/holo_blue_light</color>4. </resources>我们这里使用android的 HOLO 色调:1. <!-- A dark Holo shade of blue -->2. <color name="holo_blue_dark">#ff0099cc</color>3. <!-- A light Holo shade of blue -->4. <color name="holo_blue_light">#ff3...

安卓 logcat设置 Android logcat Settings【图】

安卓 logcat设置Android logcat Settings 作者:韩梦飞沙Author:han_meng_fei_sha 邮箱:313134555@qq.comE-mail: 313134555 @qq.com 原文:http://www.cnblogs.com/yue31313/p/7288011.html

包建强的培训课程(14):Android与ReactNative

@import url(http://i.cnblogs.com/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);@import url(http://i.cnblogs.com/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css); yle> v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} <![endif]-->l>Normal0f...

android 事件分发机制详解(OnTouchListener,OnClick)【代码】【图】

昨天做东西做到触摸事件冲突,以前也经常碰到事件冲突,想到要研究一下Android的事件冲突机制,于是从昨天开始到今天整整一天时间都要了解这方面的知识,这才懂了安卓的触摸和点击事件的机制。探究如下:   首先重写三个View布局,用来做测试:package com.example.yzj.android_8_10;import android.content.Context; import android.util.AttributeSet; import android.util.Log; import android.view.MotionEvent; import and...

ANDROID_MARS学习笔记_S02_005_AppWidget1【代码】【图】

一、AppWidget介绍1.Widget的定义创建流程(1)在res新建xml文件夹,新建appwidget-provider.xml,为widget提供元数据(2)在res/layout文件夹下定义widget的样式(3)在src新建类,extends AppWidgetProvider,自定义widget(4)在AndroidManifest.xml中把自定义的widget添加为receiver,接收APPWIDGET_UPDATE广播2. 二、代码1.res/xml/example_appwidget_info.xml1 <appwidget-provider xmlns:android="http://schemas.android.com/apk/re...