相关疑难解决方法(0)

错误的州级 - 期望使用自定义视图在Android 1.5中查看状态异常

当我切换到横向模式时,以下自定义视图会在Android 1.5r3蛋糕中引发异常:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.opentable/com.opentable.activity.SearchResults}: 
    java.lang.IllegalArgumentException: Wrong state class -- expecting View State
Run Code Online (Sandbox Code Playgroud)

此视图的XML非常简单:

public class TextProgressBar extends LinearLayout {
    public TextProgressBar(Context context, AttributeSet attrs) {
        super(context, attrs);
        ((LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.text_progress_bar, this, true);
        setGravity(Gravity.CENTER);
    }

    public TextProgressBar(Context context) {
        this(context,null);
    }
}
Run Code Online (Sandbox Code Playgroud)

有什么想法可能会发生什么?

android android-view

6
推荐指数
1
解决办法
3038
查看次数

标签 统计

android ×1

android-view ×1