安卓:将按钮添加到preference屏幕 [英] Android: add buttons to a preference screen

查看:367
本文介绍了安卓:将按钮添加到preference屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

的事情是......我想用preferenceActivity加在我的自定义列表视图中的新行。所以,我的preference ativity将包括几个的EditText preferences,我自定义TimePicker preference和目录preferences一个coulpe ......像这样: http://www.google.com/help/hc/images/android/android_ug/168567.5.png 。现在的问题是他们如何加在底部的按钮?和..是有可能使用OnClickListener获得inputed价值又如何呢?谢谢!

The thing is...I want to use PreferenceActivity to add a new row in my custom list view. So my preference ativity will consist of a few EditTextPreferences, my custom TimePickerPreference and a coulpe of ListPreferences... Like this: http://www.google.com/help/hc/images/android/android_ug/168567.5.png . The question is how they added buttons on the bottom? And.. is it possible to use OnClickListener for obtaining inputed values and how? Thanks!

推荐答案

A preferenceActivity 从继承 ListActivity 。默认情况下, ListActivity 创建自己的的ListView ,但你可以通过的setContentView提供自己的布局(),所以只要你的的ListView 在布局具有正确的机器人:ID 。 <一href="http://android.git.kernel.org/?p=platform/packages/apps/DeskClock.git;a=blob;f=res/layout/set_alarm.xml;h=466e8b71af30a145d63bb4d263595a3c3534731f;hb=HEAD"相对=nofollow>以下是布局的报警活动。

A PreferenceActivity inherits from ListActivity. By default, ListActivity creates its own ListView, but you can supply your own layout via setContentView(), so long as your ListView in the layout has the right android:id. Here is the layout for the alarm activity.

这篇关于安卓:将按钮添加到preference屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆