什么是标记和ID在android系统? [英] what are TAG and id in android?

查看:191
本文介绍了什么是标记和ID在android系统?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道switch语句作品,但我不知道这意味着什么(R.id.webbutton)。任何人都可以请解释一下它是什么,也什么标记?
是否有初学者的指导?我的意思是绝对的初学者。

I know how the switch statement works but I don't know what this means (R.id.webbutton). Can anyone please explain what it is and also what is TAG? Is there any guide for the beginners? I mean absolute beginners.

推荐答案

ID是您XML的组件的ID [可能是像意见TextView的,...的EditText的ViewGroup或类似的LinearLayout,RelativeLayout的......或任何其他在XML只需你可以这样得到的java code对其引用

Id is id of your xml's components [may be views like textview,edittext... or viewgroup like linearlayout ,relativelayout... or anything else] in xml simply you can get reference to them in java code by saying

(R.id。在XML视图的ID)

(R.id."id of your view in xml")

但首先你应该使用的setContentView(R.layout。在您的项目布局/ RES XML文件的名称)
要使用它的组件此XML文件。

but firstly you should use setContentView(R.layout."name of xml file in layout/res in your project") this xml file which you want to use it's components .

标签我用它当我想要说的String TAG = yourclassname.class.getsimpleName()来显示的logcat [在eclipse的工具,你可以看,当它运行你的应用程序的消息]消息;

TAG i use it when i want to show message in logcat [tool in eclipse you can watch your app messages when it is running] by saying String TAG= yourclassname.class.getsimpleName();

和在Log.d使用它(TAG,这里的任何字符串+变量的一些在我的课,我想知道这是在一个特定的时间值,当应用程序运行);

and use it in Log.d(TAG,"any string here"+some variable in my class i want to know it's value in a particular time when app running );

我希望明确提出,要你。

i hope that i made it clear to you .

这篇关于什么是标记和ID在android系统?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆