0

in the layout xml files that we create . we sometimes use '@' & '?' attribute what does it mean

For e.g i created toolbar.xml . i could see the ?android:attr/actionBarSize what does this mean

& what does @android:style/**ThemeOverlay.Material.Dark.ActionBar" mean

<?xml version="1.0" encoding="utf-8"?>
<Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:minHeight="**?android:attr/actionBarSize**"
    android:background="**?android:attr/colorPrimary**"
    android:theme="**@android:style/**ThemeOverlay.Material.Dark.ActionBar"/>
Deepak N
  • 25
  • 4

1 Answers1

0

If you read the document about ResourcesFromCode, you will find

if you use @..., that means a syntax to reference a resource in an XML resource:

@[<package_name>:]<resource_type>/<resource_name>

And if you use ?..., that means you are referencing a style attribute and the resource type portion is optional:

?[<package_name>:][<resource_type>/]<resource_name>

You can get more examples and detailed information in the document.

And here is a link that may help: question-mark-in-xml-attributes-for-android

nevermore
  • 15,432
  • 1
  • 12
  • 30