Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

New to android need to understand "?android:attr/actionBarSize"

Tags:

java

android

I was going through Lars Vogel's tutorial on using Fragments and I came across the following code:

android:layout_marginTop="?android:attr/actionBarSize" 

I am not sure what ?android:attr means, especially the question mark.

like image 565
user3134565 Avatar asked Dec 25 '13 13:12

user3134565


People also ask

What is ATTR actionBarSize?

In specific, android:layout_marginTop="? android:attr/actionBarSize" means: "the size (height) of the action bar".

What does ATTR mean in Android?

The Attr interface represents an attribute in an Element object. Typically the allowable values for the attribute are defined in a schema associated with the document.


2 Answers

android:attr 

is an attribute.

In specific,

android:layout_marginTop="?android:attr/actionBarSize" 

means: "the size (height) of the action bar".
? is a special character that means it's an Android internal feature.

like image 185
Phantômaxx Avatar answered Sep 28 '22 01:09

Phantômaxx


Instead of write Numerical number in value of android:layout_marginTop , you can use the height specified by actionBarSize like an Example in Android Training .

You can use ?android:attr or ?attr [ in case support library ] If you need to use any android attributes[ attr ] can be found in R.attr

For More Description about ?android:attr Question 1 ,Question 2

like image 38
ahmed hamdy Avatar answered Sep 28 '22 01:09

ahmed hamdy