上一页 1 ··· 3 4 5 6 7 8 9 下一页

2013年3月22日

摘要: 有时一个布局文件中有两个或两个以上的并列的控件,以水平布局为例,有两个控件,第一个控件width固定宽度,height为match_parent,如果想让第二个控件填充父窗体剩下所有的空间,直接match_parent或fill_parent肯定不行,可以这样做。<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_paren 阅读全文
posted @ 2013-03-22 09:50 取悦 阅读(212) 评论(0) 推荐(0) 编辑

2013年3月21日

摘要: 有时用eclipse导入一个工程时,其他地方没问题只有工程名上有个 红叉。解决办法:在工程名右键Properties-->Java Compiler-->Enable project specific settings打钩然后jdk版本选择为自己的eclipse使用的版本。 阅读全文
posted @ 2013-03-21 11:57 取悦 阅读(152) 评论(0) 推荐(0) 编辑
摘要: View中的setTag(Onbect)表示给View添加一个格外的数据,以后可以用getTag()将这个数据取出来。 可以用在多个Button添加一个监听器,每个Button都设置不同的setTag。这个监听器就通过getTag来分辨是哪个Button 被按下。 View Code import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.Button; public class Main extends Activity { @... 阅读全文
posted @ 2013-03-21 11:18 取悦 阅读(214) 评论(0) 推荐(0) 编辑
摘要: 在android开发中Listview是一个很重要的组件,它以列表的形式根据数据的长自适应展示具体内容,用户可以自由的定义listview每一列的布局,但当listview有大量的数据需要加载的时候,会占据大量内存,影响性能,这时候就需要按需填充并重新使用view来减少对象的创建。ListView加载数据都是在public View getView(int position, View convertView, ViewGroup parent) {}方法中进行的(要自定义listview都需要重写listadapter:如BaseAdapter,SimpleAdapter,CursorAda 阅读全文
posted @ 2013-03-21 11:13 取悦 阅读(144) 评论(0) 推荐(0) 编辑
摘要: ViewHolder不是Android的开发API,而是一种设计方法,就是设计个静态类,缓存一下,省得Listview更新的时候,还要重新操作。 public View getView(int pos, View convertView, ViewGroup parent){ ViewHolder holder; if (convertView == null) { convertView = mInflater.inflate(R.layout.list_item, null); holder.text = (TextView) convertView.findViewById( R.id. 阅读全文
posted @ 2013-03-21 11:11 取悦 阅读(146) 评论(0) 推荐(0) 编辑

2013年3月20日

摘要: 刚才遇到这个问题Android requires compiler compliance level 5.0 or 6.0. Found '1.4' instead.Please fix project properties1.项目右键 ->android tools->Fix Project2.如果不可以,检查Project->Properties->Java Compiler 确认JDK compliance被设置为1.6,并且enable specific seetings.来源:http://www.cnblogs.com/sunjialiang 阅读全文
posted @ 2013-03-20 11:59 取悦 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 今天真是让我头疼,搞了一上午eclipse,先是eclipse打不开,重装了,ADT又安装不上,无语了。搞来搞去,最后安装了之前下载SDK4.2时自带的eclipse,居然好用了,ADT、SVN安装一点问题都没有,真是郁闷呀,所以建议大家尽量使用谷歌提供的IDE工具,毕竟竟然是Android的主人提供出来的,肯定是最好用的。不说了,说多了都是泪啊 阅读全文
posted @ 2013-03-20 11:50 取悦 阅读(156) 评论(0) 推荐(0) 编辑
摘要: eclipse 快捷键经常忘掉,记下来Ctrl+1快速修复(最经典的快捷键,就不用多说了)Ctrl+D:删除当前行Ctrl+Alt+↓复制当前行到下一行(复制增加)Ctrl+Alt+↑复制当前行到上一行(复制增加)Alt+↓当前行和下面一行交互位置(特别实用,可以省去先剪切,再粘贴了)Alt+↑当前行和上面一行交互位置(同上)Alt+←前一个编辑的页面Alt+→下一个编辑的页面(当然是针对上面那条来说了)Alt+Enter显示当前选择资源(工程,or文件or文件)的属性Shift+Enter在当前行的下一行插入空行(这时鼠标可以在当前行的任一位置,不一定是最后)Shift+Ctrl+Enter 阅读全文
posted @ 2013-03-20 09:53 取悦 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 1、Unable to resolve target 'android-2'安装低版本的api,再default.properties这个文件中把target=android-2改成target=android-7终于就没有问题了。2、Invalid start tag LinearLayoutmain.xml放错文件夹了,应该在\res\layout下。3、INSTALL_FAILED_INSUFFICIENT_STORAGE原因:SD卡内存容量不够法一:在下图的“Additional Emulator Command Line Options”中加上“-partition- 阅读全文
posted @ 2013-03-20 09:52 取悦 阅读(413) 评论(0) 推荐(0) 编辑

2013年3月19日

摘要: Could not open the editor: Resource is out of sync with the file system当右击default.properties打开时,出现下图错误:解决方法:右击工程,Refresh一下就好了。原因:Usually happens when some files are edited outside of eclipse。 阅读全文
posted @ 2013-03-19 17:49 取悦 阅读(329) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 下一页

导航