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" />
  • 相关阅读:
    谎言,
    happy,
    架构,
    休闲游戏随想,
    IOS响应者链
    application 几个方法
    ios block 循环引用
    洛谷 P 1133 教主的花园
    Codevs 1148 == 洛谷 P1057 传球游戏
    Codevs 1169 == 洛谷 P1006 传纸条
  • 原文地址:https://www.cnblogs.com/hustdc/p/11918513.html
Copyright © 2011-2022 走看看