最近的项目中遇到listview中弹出框里面嵌套一个spinner,可是反复调试尝试后老是崩溃,调试后在这个位置出错(高亮部分):android
() { 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中加入这个主题属性就能够了(红色部分):ide
<activity android:name=".team.TeamMate"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Light.NoTitleBar" />
调试的机型为HUAWEI android4.4.2。
post