android
文章平均质量分 59
阡陌_唯
这个作者很懒,什么都没留下…
展开
-
仿微信二维码生成以及条形码生成(转)
package your.QRCode.namespace;import java.io.File;import java.io.FileOutputStream;import java.util.HashMap;import java.util.Map;import com.google.zxing.BarcodeFormat;import com.googl...原创 2014-02-13 10:56:36 · 193 阅读 · 0 评论 -
MappedByteBuffer读取大文件
RandomAccessFile randomAccessFile = new RandomAccessFile(file,"rw");FileChannel fileChannel = randomAccessFile.getChannel();long size = fileChannel.size();MappedByteBuffer mappedByteBuffe...2016-03-08 01:29:29 · 811 阅读 · 0 评论 -
自定义ImageView
图片等比例缩放,从0.0左边开始剪切 保证图片不变形/** * @Description * @Created by YCH on 2015/11/9. */public class CropImageView extends ImageView { /** * 画布的宽度 */ private int width;...2016-03-08 01:29:28 · 126 阅读 · 0 评论 -
TextView跳转到网页
private String url = "<a>https://www.baidu.com</a>";textView.setText(Html.fromHtml(url));<TextView android:id="@+id/textView" android:layout_width="match_parent" and...2016-03-08 01:29:06 · 189 阅读 · 0 评论 -
textView的背景为白色的时候 需要加重影
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="m...原创 2016-03-04 11:56:41 · 286 阅读 · 0 评论 -
AndroidEventBus基本使用
Android中的Activity, Fragment, Service之间的交互是比较麻烦的,可能我们第一想到的是使用广播接收器来在它们之间进行交互。例如上述所说在Activity-B中发一个广播,在Activity-A中注册一个广播接收器来接受该广播。但使用广播接收器稍显麻烦,如果你要将一个实体类当做数据在组件之间传递,那么该实体类还得实现序列化接口,这个成本实在有点高啊!...原创 2016-03-04 11:56:21 · 113 阅读 · 0 评论 -
利用ValueAnimator实现CountDownTimer效果
btn_code.setClickable(false); ValueAnimator valueAnimator = ValueAnimator.ofInt(59,0); valueAnimator.setDuration(59 * 1000); valueAnimator.addUpdateListener(new ValueAnimat...原创 2015-11-23 19:17:03 · 125 阅读 · 0 评论 -
android在线更新提示安装成功
废话不多说 直接贴代码Intent i = new Intent(Intent.ACTION_VIEW);i.setDataAndType(Uri.parse("file://" + apkfile.toString()), "application/vnd.android.package-archive");i.setFlags(Intent.FLAG_ACTIVITY_NEW_...原创 2015-08-11 14:13:00 · 142 阅读 · 0 评论 -
RecyclerView入门
android studio 1.2.1.1 首先配置下v7的库dependencies { compile 'com.android.support:recyclerview-v7:22.2.0'}public class RecyclerViewActivity extends Activity { private RecyclerView rec...原创 2015-07-17 14:47:41 · 74 阅读 · 0 评论 -
Gallery之无限循环
其实这个很简单的,如果你接触过ViewPager那么这个功能分分钟就实现了.布局文件就不贴出来了,就是一个简单的Gallery/** * Created by Y on 2015/7/16. * Gallery无限循环 */public class GalleryActivity extends Activity{ private Gallery gall...原创 2015-07-16 17:21:30 · 93 阅读 · 0 评论 -
Gallery入门
最近项目不是很忙,就研究点平时没有接接触过的控件,直接上代码,效果图附件,界面有点丑/** * Created by Y on 2015/7/16. */public class GalleryActivity extends Activity implements ViewSwitcher.ViewFactory{ private Gallery gallery;...原创 2015-07-16 17:09:20 · 92 阅读 · 0 评论 -
使用app打开ppt/doc等文件
//android获取一个用于打开PPT文件的intent Intent intent = new Intent("android.intent.action.VIEW"); intent.addCategory("android.intent.category.DEFAULT"); intent.addFlags(Intent.FLAG_ACTIVIT...原创 2015-06-11 15:56:09 · 699 阅读 · 0 评论 -
二维码生成与解析
private void createImage() { try { // 需要引入core包 QRCodeWriter writer = new QRCodeWriter(); // 把输入的文本转为二维码 BitMatrix martix = writer.enc...原创 2015-05-13 11:24:38 · 126 阅读 · 0 评论 -
一个小项目自定义editText
public class MyEditText extends EditText{ private Context mContext; private Drawable drawable; private Drawable bgDrawable; public MyEditText(Context context) { super(c...原创 2015-05-12 15:51:34 · 93 阅读 · 0 评论 -
textView自动滑动
今天一个功能需要用到textview滑动效果,在网上找了几个例子整理一下,以备后用<TextView android:id="@+id/textview" android:layout_width="wrap_content" android:layout_height="wrap_content" andro...原创 2015-04-17 12:51:41 · 211 阅读 · 0 评论 -
圆形图标
public class CircleImageView extends ImageView { private static final ScaleType SCALE_TYPE = ScaleType.CENTER_CROP; private static final Bitmap.Config BITMAP_CONFIG = Bitmap.Config.ARGB_8888...原创 2015-04-15 09:38:11 · 121 阅读 · 0 评论 -
notification功能实现
NotificationManager manager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE); Notification notification = new Notification(); notification.icon = R.drawable.icon; ...原创 2015-04-08 13:57:25 · 111 阅读 · 0 评论 -
设置属性自定义Item
public class Item extends RelativeLayout { private TextView tvTitle; private TextView tvValue; public Item(Context context, AttributeSet attrs) { super(context, attrs); ...2016-03-08 01:30:41 · 271 阅读 · 0 评论