- 浏览: 381958 次
- 性别:
- 来自: 北京
最新评论
-
longxishui12:
这个一定要顶得高高的。
[Android UI界面] android中仿iphone实现listview的反弹效果 -
klower.jiang:
Good job, Thank you so much!
能够兼容ViewPager的ScrollView -
ZSRTFAT:
...
file size 的大小计算
文章列表
遇到的基础问题总结
- 博客分类:
- android开发问题
1、
List<String> list 删除操作:remove(value);方法报错: java.lang.UnsupportedOperationException
解决办法:List<String>改成 ArrayList<String>
1、解决问题:
加了checkbox之后,就会影响setOnItemClickListener(new OnItemClickListener() 不起作用。
办法:checkbox 默认设置:android:focusable="false"
2、解决问题:
Info info = list.get(position);
viewHolder.checkBox.setChecked(info.getCheckState());
viewHolder.checkBox.setOnCheckedChangeListene ...
public class PopupWindowActivity extends Activity {
private Button bShow = null; // show popup window button
private boolean isClick = false; // if the button is clicked
private PopupWindow popupWindow = null;// popup window
/** Called when the activity is first created. */
@Override
...
ListView 隔行重复选中的问题
- 博客分类:
- android界面
转载;
http://blog.sina.com.cn/s/blog_713953c5010123k6.html
1. 现象 ListView中,当前点击的那行,设置为红色。往下滚动,发现隔11行或12行的那行也会变红色,但是你并没有点过它。2.原因 主要的问题在于自定义的Adapter中的getView()方法。一般我们会这样写: public View getView(int position, View convertView, ViewGroup parent) { ZuJian zuJian = null; if(conver ...
解决ANR问题:
转载:http://blog.csdn.net/gemmem/article/details/7446421
drawable 一些总结:
http://www.cnblogs.com/fighter/archive/2012/02/20/android-bitmap-drawable.html
(drawable的一些处理)
//1,已将图片保存到drawable目录下
//通过图片id获得Drawable
Resource res=gerResource();
Drawable drawable=res.getDrawable(id);//id为R.drawable.图片名称
//通过图片id获得Bitmap
Resource res=gerResourc ...
file size 的大小计算
- 博客分类:
- android
file size 的大小计算:
String android.text.format.Formatter.formatFileSize(Context context, long number)
String apkSize = Formatter.formatFileSize( , );
//返回数组,下标1代表大小,下标2代表单位 KB/MB
String[] filesize(long size){
String str="";
if(size>=1024){
...
设置指定文字颜色:
String str = "There are 36 apps in your phone.";
int index = appNum.indexOf("apps");
SpannableStringBuilder ss = new SpannableStringBuilder(str);
ForegroundColorSpan span=new ForegroundColorSpan(Color.parseColor("#F79719"));
ss.setSpan(span,16, index, ...
String name = "fdfdfdf,fdfdfs.fdfdfj'dfd" ;
name.contains(","); 是否包含,
name.contains("abc"); 是否包含
name .split(",") ; 按分号拆分返回一个数组。String[] age ;
age = new String[1];
age[0] = " " ;
Arrays.asList(array) ;
转载:http://www.cnblogs.com/TerryBlog/archive/2010/06/27/1766363.html
遇到的android_bug总结
- 博客分类:
- android异常
1、android.content.pm.PackageManager$NameNotFoundException
这个是因为安装的应用程序,不完整,apk有问题导致。
下载的时候出异常的话写一个接口。有一个回调。
出错了,怎么处理。 从arraylist删除
D/PackageManager( 1991): generateServicesMap(android.accounts.AccountAuthenticat
or): 5 services unchanged
W/System.err(19190): android.content.p ...
package com.yarin.android.TestOnPDialog;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class PDialog extends Activity
{
private Button ...
android读写文件
- 博客分类:
- android
一、 从resource中的raw文件夹中获取文件并读取数据(资源文件只能读不能写)
String res = "";
try{
InputStream in = getResources().openRawResource(R.raw.bbi);
//在\Test\res\raw\bbi.txt,
int length = in.available();
byte [] buffer = new byte[length];
in.read(buffer);
/ ...
读取assessts的txt
- 博客分类:
- android
try {
// Return an AssetManager instance for your application's package
InputStream is = getAssets().open("index.txt");
int size = is.available();
// Read the entire asset into a local byte buffer.
byte[] buffer = new byte[size];
is.read(buffer);
is.close();
...