android小事记

来源:互联网 发布:tcpip协议栈 源码 编辑:程序博客网 时间:2024/05/22 15:16

1android xml 标签ID可以重复相同吗?

答:可以重复,只要不在同一个xml文件里就可以了,因为你在setcontentview的时候已经确定xml文件了。

2、public abstract void onItemClick (AdapterView<?> parent, View view, int position, long id)

参数:

parentThe AdapterView where the click happened.
发生单击事件的AdapterView(这里是ListView)
viewThe view within the AdapterView that was clicked (this will be a view provided by the adapter)
AdapterVeiw里面发生单击事件的View
positionThe position of the view in the adapter.
位置
idThe 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的信息

5getResources()方法的作用

  1. String[] cities = getResources().getStringArray(  
  2.                         R.array.city_labels);//获取列表数据  

getResources 是获取项目中的资源文件可以用来获取你说的string,xml还可以获取图片,音乐,视频等资源文件。


6、parseInt()方法的作用

parseInt()是用来解析字符串,返回值是整数。有几个特点:

  1. 无视被解析字符串最前和最后的空格,即:" 111 "和"111"是一样的
  2. 正规格式是parseInt(string,radix)。radix可以省略,为0或者2-36之间的整数,用来表示被解析数值的进制。(注意不是解析返回结果的进制)。如果radix不在此范围内,返回NaN
  3. 如果radix 省略或者为0,则按默认进制对string进行解析。
  4. string的首字符为0,则默认解析为8进制。string首字符为0x则默认解析为16进制。其他情况默认为10进制。
  5. 解析从第一个可以解析的字符开始,到第一个不能解析的字符(如空格,标点符号等)结束。后面的字符不再解析。
  6. 如果第一个字符不可以解析,则返回NaN。如"a8989"






0 0
原创粉丝点击