随笔分类 -  android干货

干货,自备饮用水
摘要:获取SD卡根目录,兼容Android10及以上版本的方法 public File getRootFile(Context context) { File file; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { // /storage/e 阅读全文
posted @ 2022-06-20 21:30 swalka`x 阅读(1358) 评论(0) 推荐(0) 编辑
摘要:String regEx="[`~!@#$%^&*()+=|{}':;',\\[\\]./?~!@#¥%……&*()——+|{}[]‘;:”“’。,、?]"; Pattern p = Pattern.compile(regEx); Matcher m = p.matcher(name); if( m.find()){ Toast.makeT... 阅读全文
posted @ 2016-04-14 15:02 swalka`x 阅读(962) 评论(2) 推荐(0) 编辑
摘要:以下为将bitmap图像处理为毛玻璃效果的图像的工具类: 可以看出,使用方法非常简单,传入待续话的bitmap、虚化程序(一般为8),和是否重用flag。 然后,对于大图,往往会出现OOM异常的报错,那是因为当虚化开始时,虚拟机开始不断进行内存回收,包括所有软引用的回收。然后,仍然出现了内存溢出。那 阅读全文
posted @ 2016-03-14 11:30 swalka`x 阅读(1002) 评论(0) 推荐(0) 编辑
摘要:resouce文件夹下,value文件夹下,styles.xml文件中新增样式: <resources> <style name="radioButton"> <item name="android:layout_width">100dp</item> <item name="android:lay 阅读全文
posted @ 2016-03-11 14:52 swalka`x 阅读(363) 评论(0) 推荐(0) 编辑
摘要:1、在AndroidManifest.xml文件中设置: android:theme="@android:style/Theme.Translucent 此代码固定为全背景透明。 2、在Activity的onCreate()方法中设置: Window window=getWindow(); Wind 阅读全文
posted @ 2016-03-03 11:17 swalka`x 阅读(631) 评论(0) 推荐(0) 编辑
摘要:android手机back按键响应方法重构: long exitTime = System.currentTimeMillis() - 2000; public void onBackPressed() { if ((System.currentTimeMillis() - exitTime) > 阅读全文
posted @ 2016-02-25 10:49 swalka`x 阅读(307) 评论(0) 推荐(0) 编辑
摘要:Andoird实现类似iphone AssistiveTouch的控件的demo.网上也有些这方面的控件,不过貌似不怎么好用,或者是论坛需要积分下载,恰好自己在项目中有用到这种控件,就打算自己写一个,也成功实现了这种功能。今天就打算把这个小控件分享到博客上,供大家参考学习。 阅读全文
posted @ 2015-12-26 14:52 swalka`x 阅读(448) 评论(0) 推荐(0) 编辑
摘要:import java.io.BufferedReader;import java.io.ByteArrayOutputStream;import java.io.IOException;import java.io.InputStream;import java.io.InputStreamRea... 阅读全文
posted @ 2015-12-04 18:26 swalka`x 阅读(224) 评论(0) 推荐(0) 编辑
摘要:xml的形势如下: 阅读全文
posted @ 2015-11-06 11:08 swalka`x 阅读(181) 评论(0) 推荐(0) 编辑
摘要:取本地assets目录下fonts路径下的字体资源public static Typeface getTypeface(Context context) { Typeface face = Typeface.createFromAsset(context.getAssets(), "fonts... 阅读全文
posted @ 2015-08-18 00:31 swalka`x 阅读(147) 评论(0) 推荐(0) 编辑
摘要:本文介绍的是我自己做的一个简单的dialog菜单,可以直接植入到类中。方法代码:/** 显示一个靠右上的dialog列表菜单*/private void showTopBarRightButtonDropListDialog() { final Dialog dialog = new Dialog... 阅读全文
posted @ 2015-08-12 18:56 swalka`x 阅读(258) 评论(0) 推荐(0) 编辑