1、android xml 标签ID可以重复相同吗?
答:可以重复,只要不在同一个xml文件里就可以了,因为你在setcontentview的时候已经确定xml文件了。
2、public abstract void onItemClick (AdapterView<?> parent, View view, int position, long id)
参数:
parent | The AdapterView where the click happened. 发生单击事件的AdapterView(这里是ListView) |
---|---|
view | The view within the AdapterView that was clicked (this will be a view provided by the adapter) AdapterVeiw里面发生单击事件的View |
position | The position of the view in the adapter. 位置 |
id | The row id of the item that was clicked. id |
3、EditText.getText()
Return the text the TextView is displaying //返回正在EditText上显示的文本
4、sendEmptyMessage(int what)
Sends a Message containing only the what value. //发送一条只包含what的信息
5、getResources()方法的作用
- String[] cities = getResources().getStringArray(
- R.array.city_labels);//获取列表数据
getResources 是获取项目中的资源文件可以用来获取你说的string,xml还可以获取图片,音乐,视频等资源文件。
6、parseInt()方法的作用
parseInt()是用来解析字符串,返回值是整数。有几个特点:
- 无视被解析字符串最前和最后的空格,即:" 111 "和"111"是一样的
- 正规格式是parseInt(string,radix)。radix可以省略,为0或者2-36之间的整数,用来表示被解析数值的进制。(注意不是解析返回结果的进制)。如果radix不在此范围内,返回NaN
- 如果radix 省略或者为0,则按默认进制对string进行解析。
- string的首字符为0,则默认解析为8进制。string首字符为0x则默认解析为16进制。其他情况默认为10进制。
- 解析从第一个可以解析的字符开始,到第一个不能解析的字符(如空格,标点符号等)结束。后面的字符不再解析。
- 如果第一个字符不可以解析,则返回NaN。如"a8989"