关于自定义alertdialog 遇到的inflateexception错误
来源:互联网 发布:网络标志图标 编辑:程序博客网 时间:2024/05/27 08:13
写一个有进度条的alertdialog
public class MyProgressDialog extends AlertDialog.Builder{
private ProgressBar progress;
private TextView tv;
public MyProgressDialog(Context context) {
super(context);
// TODO Auto-generated constructor stub
LayoutInflater inflater = LayoutInflater.from(context);
View v =inflater.inflate(R.layout.progress_dialog_layout, null);
progress=(ProgressBar)v.findViewById(R.id.progress_bar);
tv=(TextView)v.findViewById(R.id.please_wait);
setView(v);
}
public AlertDialog show(){
return super.show();
}
}
这个dialog的layout
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayou xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
>
<ProgressBar
android:id="@+id/progress_bar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="invisible"
android:layout_centerInParent="true"
style="@style/loadingStyle"
/>
<TextView
android:id="@+id/please_wait"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="20dip"
android:text="@string/wait"
></TextView>
</LinearLayou>
然后以以下的方式去显示,但是总是有Inflaterexception,不知道是为啥,求高手解答
private Handler mHandler=new Handler(){
public void handleMessage(Message msg){
switch(msg.what){
case 0:
MyProgressDialog progress=new MyProgressDialog(MyOAuthActivity.this);
dialog=progress.show();
break;
case 1:
if(dialog!=null){
dialog.dismiss();
}
}
}
};
- 关于自定义alertdialog 遇到的inflateexception错误
- 举例说明android编程中遇到的关于android.view.InflateException错误的原因及解决办法
- 关于AlertDialog的自定义样式
- 关于AlertDialog.Builder的自定义
- 自定义view时遇到的android.view.InflateException: Binary XML file问题
- 关于自定义AlertDialog,设置不能充满全屏的解决方法
- 关于自定义AlertDialog,设置不能充满全屏的解决方法
- AlertDialog 的自定义
- AlertDialog的title自定义
- alertDialog的背景自定义
- 好看的 自定义AlertDialog
- AlertDialog的自定义
- android编程中遇到的Caused by: android.view.InflateException: Binary XML file line #13错误的原因及解决办法
- 关于android.view.inflateException异常的处理
- 关于AlertDialog的背景
- 关于AlertDialog的使用
- 关于android.view.InflateException: Binary XML file line #7: Error inflating class ViewPager错误的原因及解决办法
- 使用AlertDialog时遇到的一个小错误,简单记录下
- 本机图片缓存,距离上次好久了
- 调查称世界最受欢迎食物中餐排名第8
- 对外回调设计结合DLL应用
- 编程之美 2.14 子数组之后最大值 中的错误
- 数据窗口中多行选中程序
- 关于自定义alertdialog 遇到的inflateexception错误
- OracleCmd命令
- hdu 1.2.4
- 移动开发-Adobe Flex 4.5 SDK和Flash Builder 4.5
- 在Visual Studio 2010下编译C语言程序
- VS技巧
- 解决:Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceMode
- 编程之美 第三章 真是太弱太搞笑了
- asp.net 点击服务器按钮 不触发后台事件解决方法