昆明鱼

昆明鱼

Why use fragment?
Created2014-09-21
针对这个问题,在网上搜索了下,有以下一些看法: 1、fragments are more reusable than custom views. 作者认为,fragment能够封装单靠view无法处理的事。自定义控件无法处理跨activity交互等事件,还是需要靠activity来完成,这会增加custom views 和activity的耦合。不利于复用。而fragment可以封装更多的东西,包括AsyncTask,file and database access等。 2、the main reason to use Fragments are for the backstack and lifecyclefeatures. Otherwise, custom views are more light weight, simpler toimplement, and have the advantage that they can be nested.see here 主要原因是fragment提供了backstack支持界面状态的回退,以及生命周期特性。(在SDK...
android camera 摄像头预览画面变形
Created2013-09-08
问题:最近在处理一下camera的问题,发现在竖屏时预览图像会变形,而横屏时正常。但有的手机则是横竖屏都会变形。 结果:解决了预览变形的问题,同时支持前后摄像头,预览无变形,拍照生成的jpg照片方向正确。 环境 : android studio, xiaomi m1s android4.2 miui v5 过程: 1. 预览 preview画面变形以sdk中apidemos里的camera为例,进行修改。先重现下问题,在AndroidManifest.xml中指定了activity 的screenOrientation为landspace,则预览正常。若指定为portrait,则图像会有拉伸变形。 找到正确的previewsize继续看demo代码,mCamera.getParameters().getSupportedPreviewSizes() 可以返回当前设备支持的一组previewSize,例如: 1920x1088 1280x720 800x480 768x432 720x480 640x480 576x432 480x320384x288 352x288...
12
avatar
kmfish
记录我的技术与生活
Articles
12
Tags
7
Categories
0
Follow Me
Announcement
This is my Blog
Recent Posts
《Clean Architecture》读书笔记 - 业务逻辑2019-07-28
LifyCycle 的思考2017-08-29
一个有趣的需求实现过程:人脸表情包制作2017-02-25
通过flatmap组合多个SqlBrite的QueryObservable 使用的问题2016-12-21
修复一例 BlockingQueue.poll 导致的线程While循环无限执行占用cpu的bug2016-05-26
Tags
SqlBrite 性能优化 ListView android Android RxJava architecture
Archives
  • July 2019 1
  • August 2017 1
  • February 2017 1
  • December 2016 1
  • May 2016 1
  • January 2016 2
  • September 2015 1
  • August 2015 2
Website Info
Article Count :
12
Unique Visitors :
Page Views :
Last Update :
©2019 - 2025 By kmfish
Framework Hexo 6.3.0|Theme Butterfly 5.3.5