最近的项目中遇到listview中弹出框里面嵌套一个spinner,但是反复调试尝试后总是崩溃,调试后在这个位置出错(高亮部分):
() {
height = buildDropDown()noInputMethod = isInputMethodNotNeeded().setAllowScrollingAnchorParent(!noInputMethod).setWindowLayoutType()(.isShowing()) {
widthSpec(== ViewGroup.LayoutParams.) {
widthSpec = -} (== ViewGroup.LayoutParams.) {
widthSpec = getAnchorView().getWidth()} {
widthSpec = }
heightSpec(== ViewGroup.LayoutParams.) {
heightSpec = noInputMethod ? height : ViewGroup.LayoutParams.(noInputMethod) {
.setWidth(== ViewGroup.LayoutParams.?
ViewGroup.LayoutParams.: ).setHeight()} {
.setWidth(== ViewGroup.LayoutParams.?
ViewGroup.LayoutParams.: ).setHeight(ViewGroup.LayoutParams.)}
} (== ViewGroup.LayoutParams.) {
heightSpec = height} {
heightSpec = }
.setOutsideTouchable(!&& !).update(getAnchorView()(widthSpec < )? -: widthSpec(heightSpec < )? -: heightSpec)} {
widthSpec(== ViewGroup.LayoutParams.) {
widthSpec = ViewGroup.LayoutParams.} {
}
heightSpec(== ViewGroup.LayoutParams.) {
heightSpec = ViewGroup.LayoutParams.} {
(== ViewGroup.LayoutParams.) {
heightSpec = height} {
heightSpec = }
}
.setWidth(widthSpec).setHeight(heightSpec).setClipToScreenEnabled().setOutsideTouchable(!&& !).setTouchInterceptor().showAsDropDown(getAnchorView()).setSelection(ListView.)(!|| .isInTouchMode()) {
clearListSelection()}
(!) {
.post()}
}
}
后来在AndroidManifest.xml中加入这个主题属性就可以了(红色部分):
<activity android:name=".team.TeamMate"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Light.NoTitleBar" />
调试的机型为HUAWEI android4.4.2。