随笔分类 - Android
android:ems
摘要:设置TextView或者Edittext的宽度为2000个字符的宽度。 说明该控件最多只能显示2000个字符,超出的部分将不显示而android:maxLength=“12”表示最大可输入12个字符技巧:可通过增加“android:ems”属性的值,来使EditText宽度达到“match_parent”的效果
阅读全文
Android res/目录下子目录详解
摘要:Bitmap files (.png, .9.png, .jpg, .gif) or XML files that are compiled into the following drawable resource subtypes: Bitmap files Nine-Patches (re-si
阅读全文
Android实现Activity页面跳转切换动画特效
摘要:了解Android程序设计的人应该知道,在Android 2.0之后有了overridePendingTransition(),其中里面两个参数,一个是前一个activity的退出,另一个activity的进入。 如下代码: 首先要在res文件夹下建立anim文件夹,然后把动画效果xml文件放到里面
阅读全文
Android存储数据方式
摘要:可以查看Android开发文档中的:/docs/guide/topics/data/data-storage.html Android provides several options for you to save persistent application data. The solution
阅读全文
SharedPreferences详解
摘要:我们在开发软件的时候,常需要向用户提供软件参数设置功能,例如我们常用的微信,用户可以设置是否允许陌生人添加自己为好友. 对于软件配置参数的保存, 如果是在window下通常我们会采用ini文件进行保存. 如果是J2EE下面,我们会采用properties属性文件或者xml进行保存. 在我们的Andr
阅读全文
(转载)Android理解:显式和隐式Intent
摘要:Intent分两种:显式(Explicit intent)和隐式(Implicit intent)。 一、显式(设置Component) 显式,即直接指定需要打开的activity对应的类。 以下多种方式都是一样的,实际上都是设置Component直接指定Activity类的显式Intent,由Ma
阅读全文
使用 Fresco加载图片
摘要:概念: ImagePipeline ——负责从网络、本地图片、Content Provider(内容提供者)或者本地资源那里获取图片,压缩保存在本地存储中和在内存中保存为压缩的图片 Drawee——处理图片的渲染,由3部分组成: (1)DraweeView——显示图片的View,继承ImageVie
阅读全文
Android控件之HorizontalScrollView 去掉滚动条
摘要:在默认情况下,HorizontalScrollView控件里面的内容在滚动的情况下,会出现滚动条,为了去掉滚动条, 只需要在<HorizontalScrollView/>里面加一句 android:scrollbars="none" 或者用代码实现 setVerticalScrollBarEnabl
阅读全文
android编程取消标题栏方法(appcompat_v7、Theme.NoTitleBar)
摘要:方式一:编码方式 方式二:修改AndroidManifest.xml: 但是这种方式异动是程序总是崩溃原因,升级后theme是由appcompat_v7管理 所以这里theme应该采用android:theme=@style/Theme.AppCompat.Light.NoActionBar”,这个
阅读全文
android studio 单元测试
摘要:这里提到的单元测试前提是需要Junit 1.点击“Edit Configurations...”,在弹出窗中检查右边是否有“JUnit”部分;如果没有tests,那么点击,选中"JUnit",具体如下图红框 然后再run test 如果这样还不能行,就打开View--》Tool Windows 》B
阅读全文
Avoiding memory leaks
摘要:Android applications are, at least on the T-Mobile G1, limited to 16 MB of heap. It's both a lot of memory for a phone and yet very little for what so
阅读全文
Persisting Data to the Device
摘要:Persisting Data to the Device Edit PagePage History Overview The Android framework offers several options and strategies for persistence: Shared Prefe
阅读全文
inserting a large number of records with SQLiteStatement.
摘要:Below is a demo application I wrote that creates 100 records programmatically, inserts them using one of two methods, and then displays the time the o
阅读全文
Easier SQL with Cupboard
摘要:Overview Cupboard is a way to manage persistence in a sqlite instance for your app. It was written by Hugo Visser. His talk on the library can be foun
阅读全文
Local Databases with SQLiteOpenHelper
摘要:Overview For maximum control over local data, developers can use SQLite directly by leveraging SQLiteOpenHelper for executing SQL requests and managin
阅读全文
AppCompatActivity、ActionBarActivity、FragmentActivity和Activity的区别
摘要:Activity is the base class of all other activities, I don't think it will be deprecated. The relationship among them is: Activity <<<FragmentActivity
阅读全文
Android-Async-Http
摘要:先来看一下最基本的用法 AsyncHttpClient client = new AsyncHttpClient(); client.get("http://www.google.com", new AsyncHttpResponseHandler() { @Override public void
阅读全文
如何在Android studio中同时打开多个工程?
摘要:最近学习Android Studio,想同时打开两个Project。但是点击File->Open之后,原有的Project被关闭掉了。怎么在新的窗口中打开Project呢? 解决: 点击Help->Find Action
阅读全文
Multi-threading Android Apps for Multi-core Processors – Part 1 of 2
摘要:Can my single-threaded application benefit from multiple cores? How? Even a single-threaded application can benefit from parallel processing on differ
阅读全文
Performance Tips
摘要:To ensure your app performs well across a wide variety of devices, ensure your code is efficient at all levels and agressively optimize your performan
阅读全文
浙公网安备 33010602011771号