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" />
  • 相关阅读:
    navigator
    历史记录跳转
    更改URL
    计数器
    窗口位置和大小
    open用法
    confirm用法
    项目中访问本地node服务跨域问题
    jenkins使用
    基于Vue的SSR
  • 原文地址:https://www.cnblogs.com/hustdc/p/11918513.html
Copyright © 2011-2022 走看看