2011年11月9日

自定义VIEW findViewById返回null

搜了好久..尝试了很多方法.

clean没用.

上段代码.

public Brick(Context context,AttributeSet attr) {
		super(context);
		this.setKeepScreenOn(true);
		brick = BitmapFactory.decodeResource(getResources(), R.drawable.brick);
		np = new NinePatch(brick, brick.getNinePatchChunk(), null);
		sfh = this.getHolder();
		sfh.addCallback(this);
		paint = new Paint();
		paint.setAntiAlias(true);
		paint.setColor(Color.WHITE);
		paint.setTextSize(25f);
//		setFocusable(true);
		
		
		TypedArray params = context.obtainStyledAttributes(attr,R.styleable.Brick);
		letter = new Letter(params.getString(R.styleable.Brick_english),params.getString(R.styleable.Brick_chinese));

就是这出问题鸟~~~~

要同时把 

AttributeSet 也传递给父类.
然后就OK了..

posted @ 2011-11-09 10:35 fedition 阅读(91) 评论(0) 编辑

2011年11月7日

android的XML布局文件上使用自定义的类

在自定义的类里面必须要包括一个构造函数  XXX(Context context,AttributeSet attr){super(context,attr);}

 

在XML中使用  package.class 来调用,如报名为com.test 类为HelloWorld   则在XML中  <com.test.HelloWorld/>

posted @ 2011-11-07 22:08 fedition 阅读(30) 评论(0) 编辑

2011年9月18日

开始学习ubuntu啦~~

鸟哥的私房菜+linux程序设计+深入linux内核架构 入手~!

posted @ 2011-09-18 10:02 fedition 阅读(8) 评论(0) 编辑

2011年8月7日

PHP和JS跳转

在PHP中可以利用

<?php

header('Location: taget.html');

?>

在JS中则用

document.location="target.html";

当然.也可以在PHP中调用JS语句

记得利用转义符就好了~.

posted @ 2011-08-07 11:28 fedition 阅读(47) 评论(0) 编辑

2011年5月27日

您的手机上未安装应用程序

permission问题

posted @ 2011-05-27 13:20 fedition 阅读(85) 评论(0) 编辑

2011年5月25日

activity捕获电话输入的一个方法.

摘要: 写了个通讯录.想给每个联系人一个个性铃声.可是上网找了好久.都没有找到获取电话打进的状态.或者是INTENT不知道是我的代码有问题还是怎么的..用broadcastRecevier,或者是其他的什么的..都不行.最后看到了TelephonyManger..哇哈哈.这就伟大了..只需要在你的onPause()函数上加上以下代码TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);if(tm.getCallState()==TelephonyManager.CALL_STATE_RI阅读全文

posted @ 2011-05-25 22:43 fedition 阅读(9) 评论(0) 编辑

2011年4月17日

关于ListView中的getView()方法的理解

摘要: 最近在弄android的通讯录来玩玩~然后就在纠结那个列表怎么弄才好..在博客园里搜了一下http://www.cnblogs.com/allin/archive/2010/05/11/1732200.htmlhttp://www.cnblogs.com/xiaowenji/archive/2010/12/08/1900579.html结合这两位大人的随笔.终于搞定啦~~allin的ListView使用写得很详细了.但是最后的getView()方法让我不理解.好吧.我承认我是新手..OK.继续.然后就搜到第二个网站啦~虽说也写得比较详细..但是不是那么容易懂..或者说我笨吧~然后最后个人理解是阅读全文

posted @ 2011-04-17 10:51 fedition 阅读(277) 评论(0) 编辑

仅列出标题  

导航

统计

公告