2016-11-15 67 views
0

我在屏幕顶部有一个AutcompleteTextView,并使用了与AutocompleteTextView关联的默认List来显示我的数据。我有一个底部导航栏,位于屏幕的底部,即使显示建议,也可以看到它。AutocompleteTextView PopupWindow高度

我面对的问题是,当Popupwindow列表中的建议太多时,它会覆盖我的bottomnavigationbar(列表位于BottomNavigationBar顶部)。我想通过为PopupWindows列表视图提供边距或者控制popupWindow的高度来防止发生这种情况。有一个API setDropdownHeight,但没有marginBottom或一种方法来限制视图的底部填充整个屏幕。

/** 
* <p>Sets the current height for the auto-complete drop down list. This can 
* be a fixed height, or {@link ViewGroup.LayoutParams#MATCH_PARENT} to fill 
* the screen, or {@link ViewGroup.LayoutParams#WRAP_CONTENT} to fit the height 
* of the drop down's content.</p> 
* 
* @param height the height to use 
* 
* @attr ref android.R.styleable#AutoCompleteTextView_dropDownHeight 
*/ 
public void setDropDownHeight(int height) { 
    mPopup.setHeight(height); 
} 

在AutocompleteTextView这些API提供了选项,这个列表中包含锚,verticalOffset等原料药的顶部/开始这样做,但我一直没能找到一个API,在底部做这个。有没有办法做到这一点?

回答

0

您可以在使用属性这个小部件的描述这个属性:

enter code here 

Point pointSize = new Point(); 

getWindowManager().getDefaultDisplay().getSize(pointSize); 

myAutoCompleteTextView.setDropDownWidth(pointSize.x); 

试试这个方法

+0

你想去哪里我补充呢?哪种方法会处理这个问题? – Roadblock