最近的項目中遇到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