DeskAngel
Desktop softwares and information
Desktop softwares and information
Apr 22nd
在Android,一个单独的TextView是无法滚动的,需要放在一个ScrollView中。ScrollView提供了一系列的函数,其中fullScroll用来实现home和end键的功能,也就是滚动到顶部和底部。
但是,如果在TextView的append后面马上调用fullScroll,会发现无法滚动到真正的底部,这是因为Android下很多(如果不是全部的话)函数都是基于消息的,用消息队列来保证同步,所以函数调用多数是异步操作的。当TextView调用了append会,并不等text显示出来,而是把text的添加到消息队列之后立刻返回,fullScroll被调用的时候,text可能还没有显示,自然无法滚动到正确的位置。
解决的方法其实也很简单,使用post:
final ScrollView svResult = (ScrollView) findViewById(R.id.svResult);
svResult.post(new Runnable() {
public void run() {
svResult.fullScroll(ScrollView.FOCUS_DOWN);
}
});
Apr 20th
How to use the following formulas:
Minimal request DaCalc version: 1.2.0.0
principal*rate*(1+rate)^month/((1+rate)^month-1)profit/shares + badeprice * (1+rate)/(1-rate-tax)
Apr 16th
DaCalc is an formula calculator running on Android mobile system. It can be used to calculate like tips, tax and so on. In the following session, I will show you how to use DaCalc to calculate tips in your Android mobile phone, like Hero.
Session 1, use the pre-defined function:
Session 2, define your own function:
If you encounter any problem when using DaCalc, please do not hasitate to send me a email, with your expressions.
Apr 9th
今天因为刷Villain 5.2遇到点问题,apps2sd开启后无法启动,原因是/system/sd无法自动挂载,所以研究了一下。最后发现这个rom中,busybox的命令被映射到了/system/xbin/bb下面,但是该路径不在$PATH中,导致很多命令找不到,/etc/init.d/*下的脚本无法正确执行。
一开始以为只要在一个文件中添加
export PATH=$PATH:/system/xbin/bb
就可以了,但是实际上每个文件都是在独立的shell中运行,需要逐个添加。
最后,把修改好的文件传到/system/etc/init.d/下后,还需要运行
chmod 0755 /system/etc/init.d/*
我忘了这一步,结果浪费了一些时间。
Mar 31st
遇到这个问题是在设计一个Android程序的Ui的时候,当把EditText放在ListView中之后,就遇到了两个问题:
Google无果之后,只有自己研究,谁知这两个问题就花了我几个小时的测试。测试了Android v1.5~v2.1之后,发现原来这两个问题都和ListView的一个参数有关系,即只要没有把ListView的android:layout_height设置成“fill_parent”,就万事大吉。
这个限制没有丝毫道理,应该是ListView的一个讨厌的bug。
但是等一下,ListView是一个scroll container,如果item的个数较多,出现了滚动条,会不会有问题?应该是没有问题,这完全不搭嘎嘛!可惜事实不是这样的。如何避免这个问题,还需要再行研究。
Recent Comments