- 博客(11)
- 收藏
- 关注
原创 WebView的用法详解
1、布局<WebView android:id="@+id/wv" android:layout_width="match_parent" android:layout_height="match_parent" />2、WebView加载网页
2016-11-28 22:17:04 1900
原创 Json数据的组装和解析
1、组装成如下形式{ "a": "a_value", "b": "b_value", "c": [ "c1_value", "c2_value" ], "d": { "d1": "d1_value", "d2": "d2_value" }, "e": [ {
2016-11-21 15:33:16 6889
原创 CustomActivityOnCrash-自定义崩溃界面并带错误日志
github项目CrashCustomActivity感谢作者做出的贡献。1、添加依赖库:dependencies { compile 'cat.ereza:customactivityoncrash:1.5.0'}2、重写Application,在AndroidManifest中配置的Application类。在Application的onCreate方法中进行如下操作:@
2016-11-21 10:59:16 3450
原创 Gradle详解
1、gradle采用了Groovy语言,完全兼容maven和ivy。更多详细介绍可以看它的官网:http://www.gradle.org/。上面那个是module下的build.gradle文件,下面那个是project下的build.gradle文件。这两个文件是有区别的,project下的build.gradle是基于整个project的配置,而module下的build.gra
2016-11-19 15:05:35 1276
原创 TextView和EidtText使用技巧
TextView1、TextView同时显示图片和文字图片距离文字的距离 :android:drawablePadding;在文本框左边绘制指定图像 :android:drawableLeft;在文本框右边绘制指定图像 :android:drawableRight;在文本框上边绘制指定图像 :android:drawableTop;在文本框下边绘制指定图像 : androi
2016-11-19 14:12:45 848
原创 解决Fragment重影问题
优化Add添加Fragment,在使用hide、show中解决重影问题初始化中private FragmentManager fragmentManager;private List fragmentList = new ArrayList();//用于记录当前显示的Fragmentprivate int currentIndex = 0;protected void initDa
2016-11-13 09:49:18 1970
原创 安卓调用相机和自定义相机SurfaceView实现预览
调用原生相机拍照:private File file;public void startCamera(View view) { Intent intent = new Intent(); intent.setAction(MediaStore.ACTION_IMAGE_CAPTURE); file = new File("/mnt/sdcard/my.jpg"); intent.pu
2016-11-10 21:36:42 2458
原创 Fragment的使用总结
1、Fragment布局引入@Overridepublic View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // 将布局文件转换为View对象,然后返回 View view = inflater.inflate(R.layout.fragment, n
2016-11-09 22:19:17 409
原创 enum枚举类
枚举是指将变量的值一一列出来,变量的值只限于列举出来的值的范围内。举例:一周只有7天,一年只有12个月等。 枚举类的第一行上必须是枚举项,最后一个枚举项后的分号是可以省略的,但是如果枚举类有其他的东西,这个分号就不能省略。建议不要省略。 * 枚举类可以有构造器,但必须是private的,它默认的也是private的。 * 枚举类也可以有抽象方法,但是枚举项必须重写该方法
2016-11-07 21:37:45 450
原创 回调
一:1.在业务类中创建一个接口// 定义回调接口public interface OnSmsListener { void onStart( int total); void onProgress(int progress);}2.将接口以参数的形式传递到业务方法中,并调用相应的方法public static void Backup(Context context, On
2016-11-03 21:54:29 339
原创 Handler的基本使用
1、what用来区分哪个消息,obj来传送内容private Handler handler = new Handler(){ @Override public void handleMessage(Message msg) { switch (msg.what) { case 数字: String s = (String) msg.obj; break; } }
2016-11-01 21:35:19 414
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人