
Android
dchjmichael
这个作者很懒,什么都没留下…
展开
-
两个HorizontalScrollView一起滚动
定义一个新View,继承HorizontalScrollView,覆盖onScrollChanged方法。import android.content.Context;import android.util.AttributeSet;import android.view.View;import android.widget.HorizontalScrollView;publ转载 2011-12-16 21:49:39 · 2299 阅读 · 0 评论 -
Android 自定义Button按钮显示样式(正常、按下、获取焦点)
现在的用户对APP的外观看得很重要,如果APP内所有元件都用Android默认样式写,估计下面评论里就有一堆在骂UI丑的。今天学习自定义Button按钮样式。Button样式修改的是Button的背景(Background)属性。首先写一个定义Button样式的XML文件:新建Android XML文件,类型选Drawable,根结点选selector,文件名就buton_style吧。转载 2011-12-16 23:17:06 · 828 阅读 · 0 评论 -
浅谈android的selector,背景选择器
关于listview和button都要改变android原来控件的背景,在网上查找了一些资料不是很全,所以现在总结一下android的selector的用法。首先android的selector是在drawable/xxx.xml中配置的。先看一下listview中的状态:把下面的XML文件保存成你自己命名的.xml文件(比如list_item_bg.xml),在系统使用时根据List转载 2011-12-16 23:24:49 · 299 阅读 · 0 评论 -
Android 实现Activity后台运行
此方法其实不是主要是屏蔽Keycode_Back,让它不结束(finish())Activity,直接显示HOME界面。 Java代码 PackageManager pm = getPackageManager(); ResolveInfo homeInfo = pm.resolveActivity(new Intent(Intent.ACTION_M转载 2011-12-21 16:47:32 · 568 阅读 · 0 评论 -
无语的ClassCastException
今天在调试android程序的时候,出现了莫名其妙的ClassCastException。程序很简单,布局文件里有个EditText,id叫username_edit,然后在Activity里通过(EditText)findViewById(R.id.username_edit)来获取。但是运行的时候居然抛出了ClassCastException,无语啊,百思不得其解。后来在StackOver原创 2011-12-14 19:04:26 · 728 阅读 · 0 评论 -
Android带进度条文件上传
Being able to display a progress bar during a time consuming upload to a web server is important when dealing with users and appeasing their impatience. Here is one approach of achieving this.In t转载 2011-12-15 21:24:19 · 15563 阅读 · 13 评论 -
android获取签名,兼容5.0
废话不说,直接贴代码。public static String getApkSignatureMD5(Context context, String apkPath) throws Exception { String sign = null; Class clazz = Class.forName("android.content.pm.PackageParser"); Obj原创 2014-12-12 10:07:30 · 3351 阅读 · 4 评论