随笔分类 -  android

摘要:Textview添加了autolink后他会截获listview的item 点击事件package com.example.testtextviewlink;import android.content.Context;import android.text.Spannable;import android.text.style.ClickableSpan;import android.util.AttributeSet;import android.view.MotionEvent;import android.widget.TextView;/** * @author Jason zhan 阅读全文
posted @ 2012-11-20 18:12 天边的星星 阅读(1451) 评论(0) 推荐(0) 编辑
摘要:TextView one=(TextView) findViewById(R.id.one); Typeface tf=Typeface.createFromAsset(getAssets(),"fonts/LavishlyYoursROB.ttf"); one.setTypeface(tf); one.setText("very good"); 阅读全文
posted @ 2012-10-26 17:54 天边的星星 阅读(730) 评论(0) 推荐(0) 编辑
摘要:Android软件时,常常需要打开系统设置或信息界面,来设置相关系统项或查看系统的相关信息,这时我们就可以使用以下语句来实现:(如打开“无线和网络设置”界面) Intent intent = new Intent("/"); ComponentName cm = new ComponentName("com.android.settings","com.android.settings.WirelessSettings"); intent.setComponent(cm); intent.setAction("android 阅读全文
posted @ 2012-10-16 09:57 天边的星星 阅读(2220) 评论(0) 推荐(0) 编辑
摘要:/** * 获得当前屏幕亮度的模式 * SCREEN_BRIGHTNESS_MODE_AUTOMATIC=1 为自动调节屏幕亮度 * SCREEN_BRIGHTNESS_MODE_MANUAL=0 为手动调节屏幕亮度 */ private int getScreenMode(){ int screenMode=0; try{ screenMode = Settings.System.getInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE); } cat... 阅读全文
posted @ 2012-10-15 16:31 天边的星星 阅读(21388) 评论(0) 推荐(0) 编辑
摘要:关于listview和button都要改变android原来控件的背景,在网上查找了一些资料不是很全,所以现在总结一下android的selector的用法。首先android的selector是在drawable/xxx.xml中配置的。先看一下listview中的状态:把下面的XML文件保存成你自己命名的.xml文件(比如list_item_bg.xml),在系统使用时根据ListView中的列表项的状态来使用相应的背景图片。drawable/list_item_bg.xml<?xmlversion="1.0"encoding="utf-8"? 阅读全文
posted @ 2012-09-28 10:17 天边的星星 阅读(287) 评论(0) 推荐(0) 编辑
摘要:用途:动态设置Button、ImageView等组件在不同状态下的背景/前景显示效果。 扩展下的话可以前景/背景的显示效果可以使用网络图片。优点:灵活,减少xml的编写。参考:[AndroidOpenSource]frameworksasecorejavaandroidviewview.xml[AndroidOpenSource]frameworksasecoreesesvaluespublic.xml代码如下: /** 设置Selector。 */ public static StateListDrawable newSelector(Context context, i... 阅读全文
posted @ 2012-09-28 10:11 天边的星星 阅读(4860) 评论(0) 推荐(0) 编辑
摘要:项目中往往需要显示一段文本,如果对文本需要特定的效果,就要写自定义的span,这样的工作量会变得很大,目前android支持html格式的文本,下面就是我对android支持html的程度和使用方式的总结。Android支持html的两个接口1Spannedandroid.text.Html.fromHtml(Stringsource)输入的参数为(html格式的文本)目前android不支持全部的html的标签,目前只支持与文本显示和段落等标签,对于图片和其他的多媒体,还有一些自定义标签不能识别2Spannedandroid.text.Html.fromHtml(Stringsource,I 阅读全文
posted @ 2012-09-12 10:47 天边的星星 阅读(2289) 评论(0) 推荐(0) 编辑
摘要:Facebook问题反馈地址http://developers.facebook.com/bugs/最近遇到的授权问题 加载 voice it 时遇到了问题,请稍候再试。 API Error Code: 100 API Error Description: Invalid parameter Error Message: cancel_url URL is not properly formatted大概意思是让过几天再试试这里是官方地址http://developers.facebook.com/bugs/463219573709230?browse=search_504eeab6205a9 阅读全文
posted @ 2012-09-11 15:57 天边的星星 阅读(390) 评论(0) 推荐(0) 编辑
摘要:这是在工程中的proguard-project.txt中发现的# To enable ProGuard in your project, edit project.properties# to define the proguard.config property as described in that file.## Add project specific ProGuard rules here.# By default, the flags in this file are appended to flags specified# in ${sdk.dir}/tools/proguar 阅读全文
posted @ 2012-09-07 13:28 天边的星星 阅读(12547) 评论(0) 推荐(0) 编辑
摘要:已关注返回异常09-06 07:21:48.731: WARN/System.err(5210): com.weibo.net.WeiboException: already followed09-06 07:21:48.731: WARN/System.err(5210): at com.weibo.net.Utility.openUrl(Utility.java:354)09-06 07:21:48.731: WARN/System.err(5210): at com.weibo.net.Utility.openUrl(Utility.java:291)09-06 07:2... 阅读全文
posted @ 2012-09-07 13:26 天边的星星 阅读(465) 评论(0) 推荐(0) 编辑
摘要:创建Sqlite数据库用工具Sqlite export创建数据库的时候 不知道怎么创建自增自动 只好用代码创建一个表 供参考create table test ( _id integer PRIMARY KEY autoincrement, //自增主键 id varchar (20), //主键 headurl varchar (50), // nickname varchar (20), content varcha... 阅读全文
posted @ 2012-09-05 09:59 天边的星星 阅读(147) 评论(0) 推荐(0) 编辑
摘要:利用java的反射机制public void setZoomControlGone(View view) { Class classType; Field field; try { classType = WebView.class; field = classType.getDeclaredField("mZoomButtonsController"); field.setAccessible(true); ZoomButtonsController mZoomButtonsController = new ZoomButtonsController( view... 阅读全文
posted @ 2012-09-03 23:05 天边的星星 阅读(2906) 评论(4) 推荐(0) 编辑
摘要:Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);//设置视频大小 intent.putExtra(android.provider.MediaStore.EXTRA_SIZE_LIMIT, 768000);//设置视频时间 毫秒单位 intent.putExtra( android.provider.MediaStore.EXTRA_DURATION_LIMIT, 45000); startActivityForResult(intent, VIDEO); 阅读全文
posted @ 2012-08-23 11:24 天边的星星 阅读(2836) 评论(0) 推荐(0) 编辑
摘要:401:Authentication credentials (http://dev.twitter.com/pages/auth) were missing or incorrect. Ensure that you have set valid conumer key/secret, access token/secret, and the system clock in in sync.Twitter授权权限设置在创建App时给的 否则在发消息的时候出现 上面错误401是因为后台没有设置Setting中找到下面设置选中read and wirte 模式是Read onlyApplicat 阅读全文
posted @ 2012-08-21 16:58 天边的星星 阅读(808) 评论(0) 推荐(0) 编辑
摘要://---------------- DirTraversal.javapackage com.once;import java.io.File;import java.util.ArrayList;import java.util.LinkedList;/*** 文件夹遍历* @author once**/public class DirTraversal { //no recursion public static LinkedList<File> listLinkedFiles(String strPath) { LinkedList<File> list = n 阅读全文
posted @ 2012-08-20 16:37 天边的星星 阅读(220) 评论(0) 推荐(0) 编辑
摘要:Intent intent = new Intent();/* 开启Pictures画面Type设定为image */intent.setType( "image/*");//intent.setType( "audio/*"); //选择音频//intent.setType( "video/*"); //选择视频 (mp4 3gp 是android支持的视频格式)/* 使用Intent.ACTION_GET_CONTENT这个Action */ intent.setAction(Intent.ACTION_GET_CONTENT); 阅读全文
posted @ 2012-08-20 16:33 天边的星星 阅读(2087) 评论(0) 推荐(0) 编辑
摘要:自定义的webview使用了webView.getSettings().setJavaScriptEnabled(true);但是在加载含有JS界面时依然 还是报了ERROR/Web Console(26204):Uncaught TypeError: Cannot call method 'getItem' of null at XXXX/build.js:6等错误后来添加上webView.getSettings().setDomStorageEnabled(true);就好了。(是否开启Dom存储Api)参考官方文档http://developer.android.com/ 阅读全文
posted @ 2012-08-17 14:53 天边的星星 阅读(2695) 评论(0) 推荐(0) 编辑
摘要:简言之三种: monospace;sans; serif。并有四种表现形式:正常;斜体;粗体;粗斜体。DroidSans是默认英文 DroidSansFallback 字体是 Google 为手机"Android"内建的系统字体,支持繁体中文、简体中文、韩文、日文。支持4种文字的同时,DroidSansFallback.ttf 字体文件的体积仅有 3.04MB大小,效果类似于微软雅黑字体,而且是完全免费的。 阅读全文
posted @ 2012-08-17 10:06 天边的星星 阅读(25621) 评论(0) 推荐(0) 编辑
摘要:用自定义的webview显示网页内容时 有时候网页显示不尽人意。例如 手机显示水平有滑动的,通过设置webSettings.setDefaultZoom(zoomDensity)//WebSettings.ZoomDensity.MEDIUM ;显示的界面不同。后来发现时密度的原因,于是添加int screenDensity = getResources().getDisplayMetrics().densityDpi ; WebSettings.ZoomDensity zoomDensity = WebSettings.ZoomDensity.MEDIUM ; switch (screenD 阅读全文
posted @ 2012-08-13 16:11 天边的星星 阅读(1023) 评论(0) 推荐(0) 编辑