`
文章列表
刚使用Picasso时,发现有点卡卡的,查看了一下Memory,直接疯长到了几十兆,看了一下官网 Transform images to better fit into layouts and to reduce memory size.意思大概就是可以通过设置图片的大小来适应布局与减少内存. OK,那么问题解决了。 Picasso.with(context) .load(url) .resize(50, 50)//节约内存 .centerCrop() .into(imageView)
官网链接,Picasso.jar附上   Picasso.with(this) .load(URL) .placeholder(R.drawable.ic_launcher)//占位符 .error(R.drawable.logo_wechat)//错误时显示图片 .transform(new CropSquareTransformation()) // .resize(500, 500)//显示大小 ...

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 recycler; private RecyclerView.LayoutManager mLayoutManager; private List<HashMap<Stri ...
其实这个很简单的,如果你接触过ViewPager那么这个功能分分钟就实现了. 布局文件就不贴出来了,就是一个简单的Gallery /** * Created by Y on 2015/7/16. * Gallery无限循环 */ public class GalleryActivity extends Activity{ private Gallery gallery; //图片源数组 private Integer[] imageInteger={ R.drawable.ic_launcher, ...

Gallery入门

最近项目不是很忙,就研究点平时没有接接触过的控件,直接上代码,效果图附件,界面有点丑 /** * Created by Y on 2015/7/16. */ public class GalleryActivity extends Activity implements ViewSwitcher.ViewFactory{ private Gallery gallery; private ImageSwitcher imageSwitcher; //图片源数组 private Integer[] imageInteger={ ...
//android获取一个用于打开PPT文件的intent Intent intent = new Intent("android.intent.action.VIEW"); intent.addCategory("android.intent.category.DEFAULT"); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); Uri uri = Uri.fromFile(new File(param )); intent.setData ...
private void createImage() { try { // 需要引入core包 QRCodeWriter writer = new QRCodeWriter(); // 把输入的文本转为二维码 BitMatrix martix = writer.encode(info, BarcodeFormat.QR_CODE, QR_WIDTH, QR_HEIGHT); System.out ...
public class MyEditText extends EditText{ private Context mContext; private Drawable drawable; private Drawable bgDrawable; public MyEditText(Context context) { super(context); mContext = context; init(); } public MyEditText(Context contex ...

textView自动滑动

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

圆形图标

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; private static final int COLORDRAWABLE_DIMENSION = 1; private static final int DEFAULT_BORDER ...
NotificationManager manager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE); Notification notification = new Notification(); notification.icon = R.drawable.icon; notification.tickerText = "我在这里"; // notification.defaults = Notification.DEFAULT_SOUND; ...
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.google.zxing.EncodeHintType; import com.google.zxing.MultiFormatWriter; import com.google.zxing.WriterEx ...

JsonUtils

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

继承问题

今天在群里聊天 偶然看到一个朋友问关于继承的问题 毫不犹豫的回答  但是错了  已然忘记了子类调用父类的时候 是要调用父类无参构造函数 class Glyph { Glyph() { //step1 System.out.println("Glyph() before draw()"); //step2 draw(); //step3 System.out.println("Glyph() after draw()"); ...
(首先说明这份代码是在eoe 下载的,非原创); import android.app.TabActivity; import android.content.Intent; import android.os.Bundle; import android.widget.RadioGroup; import android.widget.TabHost; import android.widget.RadioGroup.OnCheckedChangeListener; public class TabTest extends TabActivity{ pri ...
Global site tag (gtag.js) - Google Analytics