当我切换到横向模式时,以下自定义视图会在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)
有什么想法可能会发生什么?