AutoCompleteTextView 6.0以上适配问题

xiaoxiao2021-02-28  127

AutoCompleteTextView 的样式如下: <style name="MyAutoCompleteStyle" parent="@android:style/Widget.AutoCompleteTextView"> <item name="android:popupBackground">@null</item> <item name="android:dropDownVerticalOffset">0.5dp</item> <item name="android:dropDownHorizontalOffset">-40dp</item> <item name="android:dropDownWidth">match_parent</item> </style> 将其中的@null进行赋值即可。 但是在魅族6.0系统上列表底部还有一段距离,如果将dropDownHeight设置为match_parent,在7.0手机上的列表会出现填充满全屏的问题,虽然添加了act_search.setDropDownAnchor(R.id.tl_search);锚点,还是会全屏。现在将其@null去掉之后,在7.0手机上快速滑动搜索出来的列表的时候的宽度还会变化。 查看源码感觉应该在ListPopupWindow中以下方法,但是逻辑还么有弄清楚。 @Override public void show() { int height = buildDropDown(); final boolean noInputMethod = isInputMethodNotNeeded(); mPopup.setAllowScrollingAnchorParent(!noInputMethod); mPopup.setWindowLayoutType(mDropDownWindowLayoutType); if (mPopup.isShowing()) {
转载请注明原文地址: https://www.6miu.com/read-18090.html

最新回复(0)