在 AutoCompleteTextView 中找不到符号方法 setDropDownAnimationStyle(int)

Cannot find symbol method setDropDownAnimationStyle(int) in AutoCompleteTextView

当我使用

 AutoCompleteTextView search_edit = (AutoCompleteTextView) v.findViewById(R.id.auto_search);
    search_edit.setDropDownAnimationStyle(R.style.MedicineListDropDown);

我得到 Cannot find method setDropDownAnimationStyle(int) 但根据 android source code 有一个 public 方法

 public void setDropDownAnimationStyle(int animationStyle) {
    mPopup.setAnimationStyle(animationStyle);
}

为什么我会收到错误消息?

您尝试使用的方法被标记为隐藏(等待 API 委员会批准)。这就是为什么你不能使用它。

 /**
 * <p>Sets the animation style of the auto-complete drop-down list.</p>
 *
 * <p>If the drop-down is showing, calling this method will take effect only
 * the next time the drop-down is shown.</p>
 *
 * @param animationStyle animation style to use when the drop-down appears
 *      and disappears.  Set to -1 for the default animation, 0 for no
 *      animation, or a resource identifier for an explicit animation.
 *
 * @hide Pending API council approval
 */
  • 有关@hide 的信息,请参阅this question。它描述了一种使用方法,但是强烈建议不要
  • Official documentation 对于 AutoCompleteTextView