Search code examples
androidcheckedtextviewcheckmark

CheckedTextView Attributes ID and checkMark


Just start developing with android and think instead of reading a book a webinar could be better because a webinar could also teach me short ways and how an android developer thinks when writing the code but now got a problem

<CheckedTextView
android:id="@android:id/text1"
android:checkMark="?android:attr/listChoiseIndicatorMultiple"
</>

I dont understand the above code up to now see lots of different id definitions some of them was for resources and start with @resource/name, and some of those id definitions was like @+id/name just for creating a new id for the component but this time it is using android:id/text1 and I dont understand why it is using it in that manner

Besides, the checkMark thing make me confuse more what are all those ?android:attr/listChoiseIndicatorMultiple means?

Could you please explain me and show me some resource where can I find all those magic attributes so I can cope next time by myself and hope someday can answer other newbie questions

Thanks a lot in advance, and all comment will be appreciated.


Solution

  • Well, reading the docs has always been helpful to me:

    Android Developer Site

    XML Layout specific docs

    @android:id/text1 is just a format used when the id has been previously defined. When you put a + in there that means the framework should create the resource id if it doesn't already exist.

    It's normal to use @+id/thisid when defining a new view in a layout, and then use @id/thisid to reference the aforementioned view from another part of the layout (say, in a RelativeLayout where you need to tell one widget to be below another).

    A question mark before the ID indicates that you want to access a style attribute that's defined in a style theme, rather than hard-coding the attribute.