Android API 17中添加的方法也适用于较低的API级别
API 17中引入的Android API 17中添加的方法也适用于较低的API级别,android,Android,API 17中引入的AutoCompleteTextView的方法setText(CharSequence text,boolean filter),似乎也适用于较低的android版本。我原以为它会在2.3设备中崩溃,并且出现NoSuchMethodError,但它工作正常。这不是一个真正的问题,但我只是想知道它是如何工作的:) 这是我的密码- <AutoCompleteTextView android:id="@+id/autoCompleteTextView1"
AutoCompleteTextView
的方法setText(CharSequence text,boolean filter)
,似乎也适用于较低的android版本。我原以为它会在2.3设备中崩溃,并且出现NoSuchMethodError
,但它工作正常。这不是一个真正的问题,但我只是想知道它是如何工作的:)
这是我的密码-
<AutoCompleteTextView
android:id="@+id/autoCompleteTextView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/textView1"
android:textColor="@android:color/black"
android:ems="10"
android:text="AutoCompleteTextView" >
<requestFocus />
</AutoCompleteTextView>
当谷歌说在API级别17中引入了一些东西时,他们的意思是它在API级别17中公开可用并记录在案 实际的实现可能从Android的第一天起就已经存在了,但它是通过使用特殊注释或仅通过使用
private
对开发人员隐藏的
编辑:
下面是姜饼源代码中的实际方法签名+文档,展示了这种方法的使用
/**
* Like {@link #setText(CharSequence)}, except that it can disable filtering.
*
* @param filter If <code>false</code>, no filtering will be performed
* as a result of this call.
*
* @hide Pending API council approval.
*/
public void setText(CharSequence text, boolean filter)
你是对的。我刚刚查看了
AutoCompleteTextView
gingerbrand源代码(),该方法被标记为隐藏。谢谢你的回答。@AbhishekV这就是StackOverflow的作用,不是吗?:)
/**
* Like {@link #setText(CharSequence)}, except that it can disable filtering.
*
* @param filter If <code>false</code>, no filtering will be performed
* as a result of this call.
*
* @hide Pending API council approval.
*/
public void setText(CharSequence text, boolean filter)