摘要: 新建一个HelloGridView的工程修改main.xml代码如下: <?xml version="1.0" encoding="utf-8"?><GridView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/gridview" android:layout_width="fill_parent" android:layout_height="fill_par 阅读全文
posted @ 2012-05-26 14:33 坏混混 阅读(219) 评论(0) 推荐(0) 编辑
摘要: 在设置完ListView的Adapter后,根据ListView的子项目重新计算ListView的高度,然后把高度再作为LayoutParams设置给ListView,这样它的高度就正确了,以下是源码:public class Utility { public static void setListViewHeightBasedOnChildren(ListView listView) { ListAdapter listAdapter = listView.getAdapter(); if (listAdapter == null) { ... 阅读全文
posted @ 2012-05-26 10:21 坏混混 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 在Android中要让一个程序的界面始终保持一个方向,不随手机方向转动而变化的办法: 只要在AndroidManifest.xml里面配置一下就可以了。在AndroidManifest.xml的activity(需要禁止转向的activity)配置中加入android:screenOrientation=”landscape”属性即可(landscape是横向,portrait是纵向)。例如:<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http 阅读全文
posted @ 2012-05-26 10:13 坏混混 阅读(244) 评论(0) 推荐(0) 编辑