为什么高API级别添加方法AutoCompleteTextView.setText(CharSequence,boolean)在低API级别设备上运行良好

时间:2015-04-27 11:49:48

标签: android autocompletetextview android-api-levels

为什么高API级别添加方法AutoCompleteTextView.setText(CharSequence,boolean)在低API级别设备上运行良好

doc:https://developer.android.com/reference/android/widget/AutoCompleteTextView.html#setText(java.lang.CharSequence,boolean)

文档中的

表示此方法已在API级别17中添加 但 我测试的设备是什么:中兴通讯U880(2.2.2)API8,华为U8860(2.3.6)都运行良好

我想知道为什么?

1 个答案:

答案 0 :(得分:1)

谢谢CommonsWare

Android 2.2.3源代码交叉参考:AutoCompleteTextView.java#setText

  /**
967     * Like {@link #setText(CharSequence)}, except that it can disable filtering.
968     *
969     * @param filter If <code>false</code>, no filtering will be performed
970     *        as a result of this call.
971     *
972     * @hide Pending API council approval.
973     */
974    public void setText(CharSequence text, boolean filter) {
975        if (filter) {
976            setText(text);
977        } else {
978            mBlockCompletion = true;
979            setText(text);
980            mBlockCompletion = false;
981        }
982    }