自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(32)
  • 收藏
  • 关注

设置属性自定义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 258

MappedByteBuffer读取大文件

RandomAccessFile randomAccessFile = new RandomAccessFile(file,"rw");FileChannel fileChannel = randomAccessFile.getChannel();long size = fileChannel.size();MappedByteBuffer mappedByteBuffe...

2016-03-08 01:29:29 799

自定义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 111

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 159

原创 类似于微信朋友圈回复功能

回复列表的布局就是一个简单的TextView通过数据判断是回复还是直接评论 字体颜色的改变除了SpannableString(不适用于列表)之外 还有一个Html.forHtml方法实现。String itemName = "回复 " + "<font color='#4C9CDE'>" + comments.getParent().getName() + "</fo...

2016-03-04 11:56:41 239

原创 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 267

原创 AndroidEventBus基本使用

Android中的Activity, Fragment, Service之间的交互是比较麻烦的,可能我们第一想到的是使用广播接收器来在它们之间进行交互。例如上述所说在Activity-B中发一个广播,在Activity-A中注册一个广播接收器来接受该广播。但使用广播接收器稍显麻烦,如果你要将一个实体类当做数据在组件之间传递,那么该实体类还得实现序列化接口,这个成本实在有点高啊!...

2016-03-04 11:56:21 102

viewpager +fragment页面缓存

viewpager切换fragment界面 进行网络操作是一个重复又影响体验 并且消耗流量的事情我们现在需要将fragment界面缓存起来达到保存状态的效果viewPager.setOffscreenPageLimit(2);进行多缓存一个界面 虽然消耗一些内存 但是效果还是很不错的...

2016-03-03 20:43:59 204

SpannableString改变字体颜色(局限性 不适用于列表刷新,会出现重复数据)

String str = "这是一条测试数据";SpannableString spanString = new SpannableString(str);ForegroundColorSpan span = new ForegroundColorSpan(Color.BLUE);spanString.setSpan(span, 0, str.length(), Spannable....

2016-03-03 20:43:56 399

原创 取消popuwindow黑色边框

将popuwindow设置为白色背景之后,就会出现黑色边框通过设置如下属性,可将黑色边框取消 popupWindow.setBackgroundDrawable(null);

2016-03-03 20:43:30 464

Android 如何让EditText不自动获取焦点

EditText自动获取焦点问题软键盘自动弹出设置focuseable='false'也不能从根本上解决问题使EditText焦点依然存在 但是不自动获取 可以通过设置EditText的父控件来解决<RelativeLayoutandroid:id="@+id/ll_comments"android:layout_width="match_parent"an...

2016-03-03 20:42:53 80

PullToRefreshListView调用onRefreshComplete方法 无法取消下载的bug

主要原因是由于获取数据时间过短引起的所以解决方案就产生了,我们可以延迟1s后调用onRefreshComplete方法new Handler().postAtTime(new Runnable() { @Override public void run() { prlv_details.onRefreshComplete(); }},2...

2016-03-03 20:41:18 113

原创 利用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 114

原创 listview嵌套gridview 图片资源错乱问题

listview嵌套gridview以及其他的数据显示,出现了比较奇葩的事情,同样的方法 在其他页面一切OK,但是仅仅在这里了gridview图片错乱了(其他数据显示正常),网上各种找方法,各种不行,最后还是万能的SimpleAdater解决了问题。SimpleAdapter simpleAdapter = new SimpleAdapter(activity, list, R.layout...

2015-08-19 12:02:01 210

原创 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 128

原创 Picasso内存问题

刚使用Picasso时,发现有点卡卡的,查看了一下Memory,直接疯长到了几十兆,看了一下官网Transform images to better fit into layouts and to reduce memory size.意思大概就是可以通过设置图片的大小来适应布局与减少内存.OK,那么问题解决了。Picasso.with(context) .load(url)...

2015-07-20 10:44:50 100

原创 加载图片框架Picasso

官网链接,Picasso.jar附上  Picasso.with(this) .load(URL) .placeholder(R.drawable.ic_launcher)//占位符 .error(R.drawable.logo_wechat)//错误时显示图片 ...

2015-07-17 17:57:48 77

原创 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 65

原创 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 81

原创 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 80

原创 使用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 679

原创 二维码生成与解析

private void createImage() { try { // 需要引入core包 QRCodeWriter writer = new QRCodeWriter(); // 把输入的文本转为二维码 BitMatrix martix = writer.enc...

2015-05-13 11:24:38 115

原创 一个小项目自定义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 83

原创 textView自动滑动

今天一个功能需要用到textview滑动效果,在网上找了几个例子整理一下,以备后用<TextView android:id="@+id/textview" android:layout_width="wrap_content" android:layout_height="wrap_content" andro...

2015-04-17 12:51:41 192

原创 圆形图标

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 103

原创 notification功能实现

NotificationManager manager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE); Notification notification = new Notification(); notification.icon = R.drawable.icon; ...

2015-04-08 13:57:25 99

原创 仿微信二维码生成以及条形码生成(转)

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 172

原创 JsonUtils

public class JsonUtil { // 把JsonArray的字符串转换成List<Map<String, Object>> public static List<Map<String, Object>> parseJsonArrayStrToListForMaps( String jsonArrayStr) ...

2014-01-15 10:50:46 86

原创 继承问题

今天在群里聊天 偶然看到一个朋友问关于继承的问题 毫不犹豫的回答  但是错了  已然忘记了子类调用父类的时候 是要调用父类无参构造函数class Glyph { Glyph() { //step1 System.out.println("Glyph() before draw()"); //step2 ...

2014-01-15 10:46:38 75

原创 tab_Host页面跳转,传值,刷新

(首先说明这份代码是在eoe 下载的,非原创);import android.app.TabActivity;import android.content.Intent;import android.os.Bundle;import android.widget.RadioGroup;import android.widget.TabHost;import android...

2014-01-12 15:01:12 189

原创 php配置

PHP5.4.23+APACHE2.2配置安装apache时,Server Name 均填写 localhost 解压php的zip包使apache能够使用php5ts.dll文件,最简单的方法是将php5安装路径增加到windows的path环境变量中。右击“我的电脑”——“属性”——“高级”。选择“环境变量”,选中path,点击“编辑”,在后面加上“安装路径”打开apache...

2013-12-30 22:15:17 83

原创 SharePreferencesHelper类

//本人项目期间 自己定义的一个保存密码的 帮助类public class SharePreferencesHelpers { SharedPreferences sp; SharedPreferences.Editor editor; String str [];public void ShareHelper(Context ctx,Strin...

2013-12-25 13:52:31 98

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除