zoukankan      html  css  js  c++  java
  • 关于Android的资源id

    1 @+id/xx

    这个表示向资源文件中添加一个新的id。

    @+id是在R文件中生成int xxx=value。

    有两种情况

    ①R文件中不存在xxx变量,则生成int xxx=value即为控件新建一个id值

    ②若R文件中已存在xxx变量,则不再新建,直接引用该变量对应的id值

    2 @id/xxx

    引用现有的资源。

    例子:

    <TextView
    android:id="@+id/textView2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@id/textView1" //请看这一行
    android:text="@string/textview2" />

    <TextView
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/textview1" /> 

    2 @android:id/list

    只是在使用ListView的时候才规定要用@android:id/list

    <ListView
          android:id="@+id/list_view"
          android:layout_width="match_parent"
          android:layout_height="match_parent" />
  • 相关阅读:
    [JSOI2010]解题报告+2010~2011小结
    有用的东西(emacs配置和bzoj数据下载网址)
    [JSOI2011]解题报告
    [JSOI2010]旅行题解
    [BOI2007]Mokia题解
    分块总结
    统计数字
    爬不出去的水井
    采药
    沙漠储油点
  • 原文地址:https://www.cnblogs.com/hustdc/p/11918513.html
Copyright © 2011-2022 走看看