AlerDialog可以加载xml,自定义一个AlerDialog就行了,,,
解决方案 »
- 更新了Android SDK4.1的以后,文档打开的特别慢,你们的是不是这情况?
- 【小白提问】为什么每次打开ECLIPSE某个项目的代码时,每行代码前都是XXX CAN NOT BE RESOLVED?
- 请看帖:我用一个正则表达式取两个相似的字符串时结果不是我想要的,请教原因。
- Handler和Activity跳转的问题
- 用svn去code.googl.com下载开源的项目,总是失败
- 自动更新后重新启动
- 点击通知栏,怎么获取点击的通知栏对应的程序信息
- 请问如何获取车载USB设备信息(名称等)
- Android SDK 更新不了
- 大家怎么看kotlin?最近想要不要转学
- 安卓开发高手进,布局调试
- 能不能用代码控制NFC的响应啊
http://good.gd/2931466.htm
点立即下载即可就是要改变类别里面的“正常人”“脑残”“非主流”这几个字的大小,麻烦你看看好么
protected void onPrepareDialogBuilder(Builder builder) {
super.onPrepareDialogBuilder(builder);
if (mEntries == null || mEntryValues == null) {
throw new IllegalStateException(
"ListPreference requires an entries array and an entryValues array.");
} mClickedDialogEntryIndex = getValueIndex();
builder.setSingleChoiceItems(mEntries, mClickedDialogEntryIndex,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
mClickedDialogEntryIndex = which; /*
* Clicking on an item simulates the positive button
* click, and dismisses the dialog.
*/
ListPreference.this.onClick(dialog, DialogInterface.BUTTON_POSITIVE);
dialog.dismiss();
}
});
这是onPrepareDialogBuilder的源码,因为你在方法里面写super.onPrepareDialogBuilder(builder);所以它直接继承了父类的方法,所以改变不了,但是如果你要把这句话删除,就可以自己写dialog了,但是ListPreference的数据有读不出来了,你自己可以试试,,,
{
Context context1;
View menuView;
public ListPreferenceEx(Context context, AttributeSet attrs)
{
super(context, attrs);
context1=context;
} @Override
protected void onPrepareDialogBuilder(AlertDialog.Builder builder)
{
//Builder builder1=new AlertDialog.Builder(new ContextThemeWrapper(context1, R.style.AlertDialogCustom));
//super.onPrepareDialogBuilder(builder); // To change body of overridden
// methods use File | Settings |
// File Templates.
//builder=new AlertDialog.Builder(new ContextThemeWrapper(context1, R.style.AlertDialogCustom));
menuView = View.inflate(context1, R.layout.add_tab, null);
/*builder.setNegativeButton(null, null);
builder.setTitle(null);*/
builder.setView(menuView);
}
}这是我改写你的代码,显示出我想要的dialog,但是ListPreference就没有读取xml的数据,,,