2013年2月6日

获取home键

摘要: android处于安全考虑,home键在应用层是捕获不到的,只有在底层才能获取其监听事件。但是,我们有时是需要对home键进行处理的。那么怎样才能在我们的Activity层监听到home键呢。步骤:1,首先在AndroidManifest.xml添加一项权限:<uses-permission android:name=”android.permission.DISABLE_KEYGUARD” />2,在你所需要的Activity中添加下面的方法:@Overridepublic void onAttachedToWindow(){ this.getWindow().setType(W 阅读全文

posted @ 2013-02-06 15:58 jasonyso 阅读(240) 评论(0) 推荐(0) 编辑

PreferenceScreen

摘要: PreferenceScreen可以用来实现设置界面的动态显示。一:在set.xml中添加列表显示,set.xml要放在layout目录下,<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" > <ListView android:id="@android:id/list 阅读全文

posted @ 2013-02-06 14:19 jasonyso 阅读(1316) 评论(0) 推荐(0) 编辑

导航