`
Rainbow702
  • 浏览: 1064932 次
  • 性别: Icon_minigender_1
  • 来自: 苏州
社区版块
存档分类

Android 中 "@+id"的作用是什么?以及其与android:id的区别是什么?

阅读更多

转:

 

android:id和@id一样是引用已有的id,而@+id是新增加一个id

 

在Dev Guide -> User interface -> Declaring Layout 里面看到的。
    The at-symbol (@) at the beginning of the string indicates that the XML parser should parse and expand the rest of the ID string and identify it as an ID resource. The plus-symbol (+) means that this is a new resource name that must be created and added to our resources (in the R.java file). There are a number of other ID resources that are offered by the Android framework. When referencing an Android resource ID, you do not need the plus-symbol, but must add the android package namespace, like so: android:id="@android:id/empty"

分享到:
评论

相关推荐

    Android中@id和@+id及@android:id的区别介绍

    昨天突然有新来的同事问我这个@id 和@+id 的区别 ,为什么 我们的项目都是@id 自己新增的ui 使用的@+id 这里说下我的简单的回复项目是维护的之前的是为了统一管理使用了@id 方便修改 ,因为在ids.xml 里面有引用,@...

    Android编程中@id和@+id的区别分析

    本文分析了Android编程中@id和@+id的区别。分享给大家供大家参考,具体如下: Android中的组件需要用一个int类型的值来表示,这个值就是组件标签中的id属性值。 id属性只能接受资源类型的值,也就是必须以@开头的值...

    浅谈android @id和@+id的区别

    今天,简单讲讲android里关于@id和@+id的区别。 之前,自己在布局里无论什么情况都使用@+id,可是后来发现有些代码用的是@id,自己不知道这两者之间有什么区别。于是就在网上查找资料,最终是解决了问题。这里记录...

    Android实训购物车页面

    -<LinearLayout android:background="@drawable/aaa" android:weightSum="1" android:layout_height="match_parent" android:layout_width="match_parent" android:orientation="vertical" xmlns:android=...

    ratingbar 自定义星星效果

    <item android:id="@+android:id/background" android:drawable="@drawable/xixi0" /> <item android:id="@+android:id/secondaryProgress" android:drawable="@drawable/xixi0" /> <item android:id="@+...

    Android自定义SeekBar滑动显示数字

    先来上个效果图: 当滑动时:数值显示,滑动停止时显示数字,使用FrameLayout结合SeekBar。 首先我们看看。 Layout: <?xml version=1.0 encoding=utf-... android:id=@+id/wrapper_seekbar_indicator android:la

    Android购物车代码

    -<LinearLayout android:background="@drawable/aaa" android:weightSum="1" android:layout_height="match_parent" android:layout_width="match_parent" android:orientation="vertical" xmlns:android=...

    Android布局管理器

    6 android:id="@+id/lla" 7 android:gravity="right" 8 > <!-- 声明一个 LinearLayout 布局,并设置其属性 --> 9 10 android:text="@string/add" 11 android:id="@+id/Button01" 12 android:layout_width="wrap_...

    android中ratingbar的简单使用

    android控件的展示 ... android:id="@+id/ratingbarId" android:layout_height="wrap_content" android:layout_width="wrap_content" android:numStars="5" android:stepSize="1.0" /> </LinearLayout>

    android自定义弹出框

    android:id="@+id/buttons" android:layout_below="@id/msg" android:padding="5dip" android:layout_height="wrap_content" android:orientation="horizontal"> <Button android:layout_width="135dip" android:...

    [Android应用开发电子书]

    android:id="@+id/widget0" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" > android:id="@+id/ImageView1" ...

    Android 按钮事件处理----Button

    android:id="@+id/toggleButton01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/app_close"/> android:id="@+id/imageButton01" android:layout_...

    android 时钟事件处理-----AnalogClock/DigitaClock

    android:id="@+id/analogClock01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal"/> android:id="@+id/digitalClock01" android:...

    this is a res

    android:layout_below="@+id/displayPhoto" /> android:id="@+id/lastPhoto" android:layout_width="100dp" android:layout_height="wrap_content" android:layout_alignParentStart="true" android:layout_...

    菜单(Menu) 资源示例

    <item android:id="@+id/mnuEdit" android:title="编辑" /> <item android:id="@+id/mnuDelete" android:title="删除" /> <item android:id="@+id/mnuFinish" android:title="完成" /> </menu>

    AndroidHttps服务器端和客户端简单实例

    android:id="@+id/testButton" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="HTTPS Test" /> 将该Android项目运行起来,点击按钮,在logcat中就可以看到打印信息...

    WeChatSample

    android:id="@+id/vp" android:layout_width="match_parent" android:layout_height="0dp"></android.support.v4.view.ViewPager> android:paddingTop="10dp" android:background="#ffffff" android:...

Global site tag (gtag.js) - Google Analytics